Problem:- You will be predicting the costs of used cars given the data collected from various sources and distributed across various locations in India.
FEATURES:

Name: The brand and model of the car.

Location: The location in which the car is being sold or is available for purchase.

Year: The year or edition of the model.

Kilometers_Driven: The total kilometres driven in the car by the previous owner(s) in KM.

Fuel_Type: The type of fuel used by the car.

Transmission: The type of transmission used by the car.

Owner_Type: Whether the ownership is Firsthand, Second hand or other.

Mileage: The standard mileage offered by the car company in kmpl or km/kg

Engine: The displacement volume of the engine in cc.

Power: The maximum power of the engine in bhp.

Seats: The number of seats in the car.

New_Price: The price of a new car of the same model.

Price: The price of the used car in INR Lakhs.

Importing Libraries

In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.linear_model import Lasso
from sklearn.ensemble import RandomForestRegressor,  GradientBoostingRegressor
from sklearn.model_selection import KFold, cross_val_score, train_test_split
from sklearn.metrics import mean_squared_error
import xgboost as xgb
import lightgbm as lgb
from sklearn.neighbors import KNeighborsClassifier
from sklearn import model_selection
from sklearn.preprocessing import MinMaxScaler
import warnings
warnings.filterwarnings("ignore")

Data Collection

In [2]:
Train=pd.read_excel('Data_Train.xlsx')
Test=pd.read_excel('Data_Test.xlsx')
In [3]:
Train.head()
Out[3]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price
0 Maruti Wagon R LXI CNG Mumbai 2010 72000 CNG Manual First 26.6 km/kg 998 CC 58.16 bhp 5.0 1.75
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 Diesel Manual First 19.67 kmpl 1582 CC 126.2 bhp 5.0 12.50
2 Honda Jazz V Chennai 2011 46000 Petrol Manual First 18.2 kmpl 1199 CC 88.7 bhp 5.0 4.50
3 Maruti Ertiga VDI Chennai 2012 87000 Diesel Manual First 20.77 kmpl 1248 CC 88.76 bhp 7.0 6.00
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 Diesel Automatic Second 15.2 kmpl 1968 CC 140.8 bhp 5.0 17.74
In [5]:
Test.shape ,Train.shape
Out[5]:
((1234, 11), (6019, 12))
In [6]:
Train.duplicated().sum()
Out[6]:
0
In [7]:
Test_copy=Test.copy()

Data Cleaning & Imputing Missing Values

In [8]:
Test[Test.duplicated()]
Test[Test['Name'].str.contains("Honda City 1.5 E MT")]
Out[8]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats
287 Honda City 1.5 E MT Hyderabad 2009 66000 Petrol Manual First 17.0 kmpl 1497 CC 118 bhp 5.0
294 Honda City 1.5 E MT Pune 2012 88000 Petrol Manual Third 17.0 kmpl 1497 CC 118 bhp 5.0
479 Honda City 1.5 E MT Mumbai 2010 52000 Petrol Manual First 17.0 kmpl 1497 CC 118 bhp 5.0
563 Honda City 1.5 E MT Mumbai 2010 52000 Petrol Manual First 17.0 kmpl 1497 CC 118 bhp 5.0
767 Honda City 1.5 E MT Ahmedabad 2011 65000 Petrol Manual First 17.0 kmpl 1497 CC 118 bhp 5.0
897 Honda City 1.5 E MT Ahmedabad 2011 52000 Petrol Manual First 17.0 kmpl 1497 CC 118 bhp 5.0
In [9]:
#removing unit of Mileage column
for Unit in ['km/kg','kmpl']:
    Train.Mileage = Train.Mileage.str.replace(Unit,' ')
Train.Mileage=Train.Mileage.astype(float)

#creating new columns
Train['Mileage_per_kg']=[0.0 for i in range(len(Train.Mileage))]
Train['Mileage_per_l']=[0.0 for i in range(len(Train.Mileage))]
Train
for i in range(len(Train)):
    if (Train['Fuel_Type'][i]=='CNG'):
        Train['Mileage_per_kg'][i]=Train['Mileage'][i]
    if (Train['Fuel_Type'][i]=='LPG'):
        Train['Mileage_per_kg'][i]=Train['Mileage'][i]
    if (Train['Fuel_Type'][i]=='Petrol'):
        Train['Mileage_per_l'][i]=Train['Mileage'][i]
    if (Train['Fuel_Type'][i]=='Diesel'):
        Train['Mileage_per_l'][i]=Train['Mileage'][i]
    if (Train['Fuel_Type'][i]=='Electric'):
        Train['Mileage_per_l'][i]=0
        Train['Mileage_per_kg'][i]=0
Train['Mileage_per_kg']=Train['Mileage_per_kg'].astype(float)

Train['Mileage_per_l']=Train['Mileage_per_l'].astype(float)
Train
Out[9]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l
0 Maruti Wagon R LXI CNG Mumbai 2010 72000 CNG Manual First 26.60 998 CC 58.16 bhp 5.0 1.75 26.6 0.00
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 Diesel Manual First 19.67 1582 CC 126.2 bhp 5.0 12.50 0.0 19.67
2 Honda Jazz V Chennai 2011 46000 Petrol Manual First 18.20 1199 CC 88.7 bhp 5.0 4.50 0.0 18.20
3 Maruti Ertiga VDI Chennai 2012 87000 Diesel Manual First 20.77 1248 CC 88.76 bhp 7.0 6.00 0.0 20.77
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 Diesel Automatic Second 15.20 1968 CC 140.8 bhp 5.0 17.74 0.0 15.20
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 27365 Diesel Manual First 28.40 1248 CC 74 bhp 5.0 4.75 0.0 28.40
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 100000 Diesel Manual First 24.40 1120 CC 71 bhp 5.0 4.00 0.0 24.40
6016 Mahindra Xylo D4 BSIV Jaipur 2012 55000 Diesel Manual Second 14.00 2498 CC 112 bhp 8.0 2.90 0.0 14.00
6017 Maruti Wagon R VXI Kolkata 2013 46000 Petrol Manual First 18.90 998 CC 67.1 bhp 5.0 2.65 0.0 18.90
6018 Chevrolet Beat Diesel Hyderabad 2011 47000 Diesel Manual First 25.44 936 CC 57.6 bhp 5.0 2.50 0.0 25.44

6019 rows × 14 columns

In [10]:
Train['Fuel_Type'].unique()
Test['Fuel_Type'].unique()
Test.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1234 entries, 0 to 1233
Data columns (total 11 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Name               1234 non-null   object 
 1   Location           1234 non-null   object 
 2   Year               1234 non-null   int64  
 3   Kilometers_Driven  1234 non-null   int64  
 4   Fuel_Type          1234 non-null   object 
 5   Transmission       1234 non-null   object 
 6   Owner_Type         1234 non-null   object 
 7   Mileage            1234 non-null   object 
 8   Engine             1224 non-null   object 
 9   Power              1224 non-null   object 
 10  Seats              1223 non-null   float64
dtypes: float64(1), int64(2), object(8)
memory usage: 106.2+ KB
In [11]:
#removing unit of Mileage column in test data
for Unit in ['km/kg','kmpl']:
    Test.Mileage = Test.Mileage.str.replace(Unit,' ')
Test.Mileage=Test.Mileage.astype(float)
Test
#creating new columns in test data
Test['Mileage_per_kg']=[0.0 for i in range(len(Test.Mileage))]
Test['Mileage_per_l']=[0.0 for i in range(len(Test.Mileage))]
Test
for i in range(len(Test)):
    if (Test['Fuel_Type'][i]=='CNG'):
        Test['Mileage_per_kg'][i]=Test['Mileage'][i]
    if (Test['Fuel_Type'][i]=='LPG'):
        Test['Mileage_per_kg'][i]=Test['Mileage'][i]
    if (Test['Fuel_Type'][i]=='Petrol'):
        Test['Mileage_per_l'][i]=Test['Mileage'][i]
    if (Test['Fuel_Type'][i]=='Diesel'):
        Test['Mileage_per_l'][i]=Test['Mileage'][i]
    if (Test['Fuel_Type'][i]=='Electric'):
        Test['Mileage_per_l'][i]=0
        Test['Mileage_per_kg'][i]=0
        
Test['Mileage_per_kg']=Test['Mileage_per_kg'].astype(float)

Test['Mileage_per_l']=Test['Mileage_per_l'].astype(float)
Test
Out[11]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 998 CC 58.2 bhp 4.0 32.26 0.00
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.70 796 CC 47.3 bhp 5.0 0.00 24.70
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 2393 CC 147.8 bhp 7.0 0.00 13.68
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 1364 CC null bhp 5.0 0.00 23.59
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.50 1197 CC 82.85 bhp 5.0 0.00 18.50
... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 89411 Diesel Manual First 20.54 1598 CC 103.6 bhp 5.0 0.00 20.54
1230 Volkswagen Polo GT TSI Mumbai 2015 59000 Petrol Automatic First 17.21 1197 CC 103.6 bhp 5.0 0.00 17.21
1231 Nissan Micra Diesel XV Kolkata 2012 28000 Diesel Manual First 23.08 1461 CC 63.1 bhp 5.0 0.00 23.08
1232 Volkswagen Polo GT TSI Pune 2013 52262 Petrol Automatic Third 17.20 1197 CC 103.6 bhp 5.0 0.00 17.20
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 72443 Diesel Automatic First 10.00 2148 CC 170 bhp 5.0 0.00 10.00

1234 rows × 13 columns

In [12]:
#removing units from Mileage,Power,Engine

Train['Engine']=Train['Engine'].str.strip('CC')
Train['Power']=Train['Power'].str.strip('bhp')
Train
Out[12]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l
0 Maruti Wagon R LXI CNG Mumbai 2010 72000 CNG Manual First 26.60 998 58.16 5.0 1.75 26.6 0.00
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 Diesel Manual First 19.67 1582 126.2 5.0 12.50 0.0 19.67
2 Honda Jazz V Chennai 2011 46000 Petrol Manual First 18.20 1199 88.7 5.0 4.50 0.0 18.20
3 Maruti Ertiga VDI Chennai 2012 87000 Diesel Manual First 20.77 1248 88.76 7.0 6.00 0.0 20.77
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 Diesel Automatic Second 15.20 1968 140.8 5.0 17.74 0.0 15.20
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 27365 Diesel Manual First 28.40 1248 74 5.0 4.75 0.0 28.40
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 100000 Diesel Manual First 24.40 1120 71 5.0 4.00 0.0 24.40
6016 Mahindra Xylo D4 BSIV Jaipur 2012 55000 Diesel Manual Second 14.00 2498 112 8.0 2.90 0.0 14.00
6017 Maruti Wagon R VXI Kolkata 2013 46000 Petrol Manual First 18.90 998 67.1 5.0 2.65 0.0 18.90
6018 Chevrolet Beat Diesel Hyderabad 2011 47000 Diesel Manual First 25.44 936 57.6 5.0 2.50 0.0 25.44

6019 rows × 14 columns

In [13]:
Test
Out[13]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 998 CC 58.2 bhp 4.0 32.26 0.00
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.70 796 CC 47.3 bhp 5.0 0.00 24.70
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 2393 CC 147.8 bhp 7.0 0.00 13.68
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 1364 CC null bhp 5.0 0.00 23.59
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.50 1197 CC 82.85 bhp 5.0 0.00 18.50
... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 89411 Diesel Manual First 20.54 1598 CC 103.6 bhp 5.0 0.00 20.54
1230 Volkswagen Polo GT TSI Mumbai 2015 59000 Petrol Automatic First 17.21 1197 CC 103.6 bhp 5.0 0.00 17.21
1231 Nissan Micra Diesel XV Kolkata 2012 28000 Diesel Manual First 23.08 1461 CC 63.1 bhp 5.0 0.00 23.08
1232 Volkswagen Polo GT TSI Pune 2013 52262 Petrol Automatic Third 17.20 1197 CC 103.6 bhp 5.0 0.00 17.20
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 72443 Diesel Automatic First 10.00 2148 CC 170 bhp 5.0 0.00 10.00

1234 rows × 13 columns

In [14]:
#removing Units from Test data

Test['Engine']=Test['Engine'].str.strip('CC')
Test['Power']=Test['Power'].str.strip('bhp')
Test
Out[14]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 998 58.2 4.0 32.26 0.00
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.70 796 47.3 5.0 0.00 24.70
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 2393 147.8 7.0 0.00 13.68
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 1364 null 5.0 0.00 23.59
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.50 1197 82.85 5.0 0.00 18.50
... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 89411 Diesel Manual First 20.54 1598 103.6 5.0 0.00 20.54
1230 Volkswagen Polo GT TSI Mumbai 2015 59000 Petrol Automatic First 17.21 1197 103.6 5.0 0.00 17.21
1231 Nissan Micra Diesel XV Kolkata 2012 28000 Diesel Manual First 23.08 1461 63.1 5.0 0.00 23.08
1232 Volkswagen Polo GT TSI Pune 2013 52262 Petrol Automatic Third 17.20 1197 103.6 5.0 0.00 17.20
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 72443 Diesel Automatic First 10.00 2148 170 5.0 0.00 10.00

1234 rows × 13 columns

In [15]:
#Spliting Name 
Train['Brand']=Train['Name'].str.split(' ').str[0]
Train['Model']=Train['Name'].str.split(' ').str[1]
Train['Version']=Train['Name'].str.split(' ').str[2:7].str.join(" ") 
Train
Out[15]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version
0 Maruti Wagon R LXI CNG Mumbai 2010 72000 CNG Manual First 26.60 998 58.16 5.0 1.75 26.6 0.00 Maruti Wagon R LXI CNG
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 Diesel Manual First 19.67 1582 126.2 5.0 12.50 0.0 19.67 Hyundai Creta 1.6 CRDi SX Option
2 Honda Jazz V Chennai 2011 46000 Petrol Manual First 18.20 1199 88.7 5.0 4.50 0.0 18.20 Honda Jazz V
3 Maruti Ertiga VDI Chennai 2012 87000 Diesel Manual First 20.77 1248 88.76 7.0 6.00 0.0 20.77 Maruti Ertiga VDI
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 Diesel Automatic Second 15.20 1968 140.8 5.0 17.74 0.0 15.20 Audi A4 New 2.0 TDI Multitronic
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 27365 Diesel Manual First 28.40 1248 74 5.0 4.75 0.0 28.40 Maruti Swift VDI
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 100000 Diesel Manual First 24.40 1120 71 5.0 4.00 0.0 24.40 Hyundai Xcent 1.1 CRDi S
6016 Mahindra Xylo D4 BSIV Jaipur 2012 55000 Diesel Manual Second 14.00 2498 112 8.0 2.90 0.0 14.00 Mahindra Xylo D4 BSIV
6017 Maruti Wagon R VXI Kolkata 2013 46000 Petrol Manual First 18.90 998 67.1 5.0 2.65 0.0 18.90 Maruti Wagon R VXI
6018 Chevrolet Beat Diesel Hyderabad 2011 47000 Diesel Manual First 25.44 936 57.6 5.0 2.50 0.0 25.44 Chevrolet Beat Diesel

6019 rows × 17 columns

In [16]:
#Spliting Name in Test Data
Test['Brand']=Test['Name'].str.split(' ').str[0]
Test['Model']=Test['Name'].str.split(' ').str[1]
Test['Version']=Test['Name'].str.split(' ').str[2:7].str.join(" ") 
Test
Out[16]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l Brand Model Version
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 998 58.2 4.0 32.26 0.00 Maruti Alto K10 LXI CNG
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.70 796 47.3 5.0 0.00 24.70 Maruti Alto 800 2016-2019 LXI
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 2393 147.8 7.0 0.00 13.68 Toyota Innova Crysta Touring Sport 2.4 MT
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 1364 null 5.0 0.00 23.59 Toyota Etios Liva GD
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.50 1197 82.85 5.0 0.00 18.50 Hyundai i20 Magna
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 89411 Diesel Manual First 20.54 1598 103.6 5.0 0.00 20.54 Volkswagen Vento Diesel Trendline
1230 Volkswagen Polo GT TSI Mumbai 2015 59000 Petrol Automatic First 17.21 1197 103.6 5.0 0.00 17.21 Volkswagen Polo GT TSI
1231 Nissan Micra Diesel XV Kolkata 2012 28000 Diesel Manual First 23.08 1461 63.1 5.0 0.00 23.08 Nissan Micra Diesel XV
1232 Volkswagen Polo GT TSI Pune 2013 52262 Petrol Automatic Third 17.20 1197 103.6 5.0 0.00 17.20 Volkswagen Polo GT TSI
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 72443 Diesel Automatic First 10.00 2148 170 5.0 0.00 10.00 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avantgarde

1234 rows × 16 columns

Dealing with null/missing values

In [17]:
Train.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 6019 entries, 0 to 6018
Data columns (total 17 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Name               6019 non-null   object 
 1   Location           6019 non-null   object 
 2   Year               6019 non-null   int64  
 3   Kilometers_Driven  6019 non-null   int64  
 4   Fuel_Type          6019 non-null   object 
 5   Transmission       6019 non-null   object 
 6   Owner_Type         6019 non-null   object 
 7   Mileage            6017 non-null   float64
 8   Engine             5983 non-null   object 
 9   Power              5983 non-null   object 
 10  Seats              5977 non-null   float64
 11  Price              6019 non-null   float64
 12  Mileage_per_kg     6019 non-null   float64
 13  Mileage_per_l      6019 non-null   float64
 14  Brand              6019 non-null   object 
 15  Model              6019 non-null   object 
 16  Version            6019 non-null   object 
dtypes: float64(5), int64(2), object(10)
memory usage: 799.5+ KB
In [18]:
Test.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1234 entries, 0 to 1233
Data columns (total 16 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Name               1234 non-null   object 
 1   Location           1234 non-null   object 
 2   Year               1234 non-null   int64  
 3   Kilometers_Driven  1234 non-null   int64  
 4   Fuel_Type          1234 non-null   object 
 5   Transmission       1234 non-null   object 
 6   Owner_Type         1234 non-null   object 
 7   Mileage            1234 non-null   float64
 8   Engine             1224 non-null   object 
 9   Power              1224 non-null   object 
 10  Seats              1223 non-null   float64
 11  Mileage_per_kg     1234 non-null   float64
 12  Mileage_per_l      1234 non-null   float64
 13  Brand              1234 non-null   object 
 14  Model              1234 non-null   object 
 15  Version            1234 non-null   object 
dtypes: float64(4), int64(2), object(10)
memory usage: 154.4+ KB
In [19]:
Train.isnull().sum()
Out[19]:
Name                  0
Location              0
Year                  0
Kilometers_Driven     0
Fuel_Type             0
Transmission          0
Owner_Type            0
Mileage               2
Engine               36
Power                36
Seats                42
Price                 0
Mileage_per_kg        0
Mileage_per_l         0
Brand                 0
Model                 0
Version               0
dtype: int64
In [20]:
#Imputing Null Values in Power
for i in range(len(Train)):
     if (Train['Power'][i]=='null '):
        Train['Power'][i]=0.0
Train['Power']=Train['Power'].astype(float)        
        
for i in range(len(Test)):
     if (Test['Power'][i]=='null '):
        Test['Power'][i]=0.0
        
Test['Power']=Test['Power'].astype(float)        
In [21]:
#set of columns which contains null values
Null_column_Train = ["Mileage","Engine","Power","Seats"] 
Null_column_Test = ["Engine","Power","Seats"] 
In [22]:
# Defining a function for Replacing null values
def Null_replacing_Fun(dataset , Null_column):
    for i in range(len(Null_column)):
       dataset[Null_column[i]].fillna(dataset[Null_column[i]].mode()[0] , inplace = True)

    print(dataset)
In [23]:
#calling funtion to null replacing for Train Data 
Null_replacing_Fun(Train , Null_column_Train)
                                  Name    Location  Year  Kilometers_Driven  \
0               Maruti Wagon R LXI CNG      Mumbai  2010              72000   
1     Hyundai Creta 1.6 CRDi SX Option        Pune  2015              41000   
2                         Honda Jazz V     Chennai  2011              46000   
3                    Maruti Ertiga VDI     Chennai  2012              87000   
4      Audi A4 New 2.0 TDI Multitronic  Coimbatore  2013              40670   
...                                ...         ...   ...                ...   
6014                  Maruti Swift VDI       Delhi  2014              27365   
6015          Hyundai Xcent 1.1 CRDi S      Jaipur  2015             100000   
6016             Mahindra Xylo D4 BSIV      Jaipur  2012              55000   
6017                Maruti Wagon R VXI     Kolkata  2013              46000   
6018             Chevrolet Beat Diesel   Hyderabad  2011              47000   

     Fuel_Type Transmission Owner_Type  Mileage Engine   Power  Seats  Price  \
0          CNG       Manual      First    26.60   998    58.16    5.0   1.75   
1       Diesel       Manual      First    19.67  1582   126.20    5.0  12.50   
2       Petrol       Manual      First    18.20  1199    88.70    5.0   4.50   
3       Diesel       Manual      First    20.77  1248    88.76    7.0   6.00   
4       Diesel    Automatic     Second    15.20  1968   140.80    5.0  17.74   
...        ...          ...        ...      ...    ...     ...    ...    ...   
6014    Diesel       Manual      First    28.40  1248    74.00    5.0   4.75   
6015    Diesel       Manual      First    24.40  1120    71.00    5.0   4.00   
6016    Diesel       Manual     Second    14.00  2498   112.00    8.0   2.90   
6017    Petrol       Manual      First    18.90   998    67.10    5.0   2.65   
6018    Diesel       Manual      First    25.44   936    57.60    5.0   2.50   

      Mileage_per_kg  Mileage_per_l      Brand   Model  \
0               26.6           0.00     Maruti   Wagon   
1                0.0          19.67    Hyundai   Creta   
2                0.0          18.20      Honda    Jazz   
3                0.0          20.77     Maruti  Ertiga   
4                0.0          15.20       Audi      A4   
...              ...            ...        ...     ...   
6014             0.0          28.40     Maruti   Swift   
6015             0.0          24.40    Hyundai   Xcent   
6016             0.0          14.00   Mahindra    Xylo   
6017             0.0          18.90     Maruti   Wagon   
6018             0.0          25.44  Chevrolet    Beat   

                      Version  
0                   R LXI CNG  
1          1.6 CRDi SX Option  
2                           V  
3                         VDI  
4     New 2.0 TDI Multitronic  
...                       ...  
6014                      VDI  
6015               1.1 CRDi S  
6016                  D4 BSIV  
6017                    R VXI  
6018                   Diesel  

[6019 rows x 17 columns]
In [24]:
Train.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 6019 entries, 0 to 6018
Data columns (total 17 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Name               6019 non-null   object 
 1   Location           6019 non-null   object 
 2   Year               6019 non-null   int64  
 3   Kilometers_Driven  6019 non-null   int64  
 4   Fuel_Type          6019 non-null   object 
 5   Transmission       6019 non-null   object 
 6   Owner_Type         6019 non-null   object 
 7   Mileage            6019 non-null   float64
 8   Engine             6019 non-null   object 
 9   Power              6019 non-null   float64
 10  Seats              6019 non-null   float64
 11  Price              6019 non-null   float64
 12  Mileage_per_kg     6019 non-null   float64
 13  Mileage_per_l      6019 non-null   float64
 14  Brand              6019 non-null   object 
 15  Model              6019 non-null   object 
 16  Version            6019 non-null   object 
dtypes: float64(6), int64(2), object(9)
memory usage: 799.5+ KB
In [25]:
Train.isnull().sum()
Out[25]:
Name                 0
Location             0
Year                 0
Kilometers_Driven    0
Fuel_Type            0
Transmission         0
Owner_Type           0
Mileage              0
Engine               0
Power                0
Seats                0
Price                0
Mileage_per_kg       0
Mileage_per_l        0
Brand                0
Model                0
Version              0
dtype: int64
In [26]:
#calling function for Test data set
Null_replacing_Fun(Test , Null_column_Test)
                                                   Name    Location  Year  \
0                               Maruti Alto K10 LXI CNG       Delhi  2014   
1                         Maruti Alto 800 2016-2019 LXI  Coimbatore  2013   
2             Toyota Innova Crysta Touring Sport 2.4 MT      Mumbai  2017   
3                                  Toyota Etios Liva GD   Hyderabad  2012   
4                                     Hyundai i20 Magna      Mumbai  2014   
...                                                 ...         ...   ...   
1229                  Volkswagen Vento Diesel Trendline   Hyderabad  2011   
1230                             Volkswagen Polo GT TSI      Mumbai  2015   
1231                             Nissan Micra Diesel XV     Kolkata  2012   
1232                             Volkswagen Polo GT TSI        Pune  2013   
1233  Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan...       Kochi  2014   

      Kilometers_Driven Fuel_Type Transmission Owner_Type  Mileage Engine  \
0                 40929       CNG       Manual      First    32.26   998    
1                 54493    Petrol       Manual     Second    24.70   796    
2                 34000    Diesel       Manual      First    13.68  2393    
3                139000    Diesel       Manual      First    23.59  1364    
4                 29000    Petrol       Manual      First    18.50  1197    
...                 ...       ...          ...        ...      ...    ...   
1229              89411    Diesel       Manual      First    20.54  1598    
1230              59000    Petrol    Automatic      First    17.21  1197    
1231              28000    Diesel       Manual      First    23.08  1461    
1232              52262    Petrol    Automatic      Third    17.20  1197    
1233              72443    Diesel    Automatic      First    10.00  2148    

       Power  Seats  Mileage_per_kg  Mileage_per_l          Brand    Model  \
0      58.20    4.0           32.26           0.00         Maruti     Alto   
1      47.30    5.0            0.00          24.70         Maruti     Alto   
2     147.80    7.0            0.00          13.68         Toyota   Innova   
3       0.00    5.0            0.00          23.59         Toyota    Etios   
4      82.85    5.0            0.00          18.50        Hyundai      i20   
...      ...    ...             ...            ...            ...      ...   
1229  103.60    5.0            0.00          20.54     Volkswagen    Vento   
1230  103.60    5.0            0.00          17.21     Volkswagen     Polo   
1231   63.10    5.0            0.00          23.08         Nissan    Micra   
1232  103.60    5.0            0.00          17.20     Volkswagen     Polo   
1233  170.00    5.0            0.00          10.00  Mercedes-Benz  E-Class   

                             Version  
0                        K10 LXI CNG  
1                  800 2016-2019 LXI  
2        Crysta Touring Sport 2.4 MT  
3                            Liva GD  
4                              Magna  
...                              ...  
1229                Diesel Trendline  
1230                          GT TSI  
1231                       Diesel XV  
1232                          GT TSI  
1233  2009-2013 E 220 CDI Avantgarde  

[1234 rows x 16 columns]
In [27]:
Test.isnull().sum()
Out[27]:
Name                 0
Location             0
Year                 0
Kilometers_Driven    0
Fuel_Type            0
Transmission         0
Owner_Type           0
Mileage              0
Engine               0
Power                0
Seats                0
Mileage_per_kg       0
Mileage_per_l        0
Brand                0
Model                0
Version              0
dtype: int64
In [28]:
Test.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1234 entries, 0 to 1233
Data columns (total 16 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Name               1234 non-null   object 
 1   Location           1234 non-null   object 
 2   Year               1234 non-null   int64  
 3   Kilometers_Driven  1234 non-null   int64  
 4   Fuel_Type          1234 non-null   object 
 5   Transmission       1234 non-null   object 
 6   Owner_Type         1234 non-null   object 
 7   Mileage            1234 non-null   float64
 8   Engine             1234 non-null   object 
 9   Power              1234 non-null   float64
 10  Seats              1234 non-null   float64
 11  Mileage_per_kg     1234 non-null   float64
 12  Mileage_per_l      1234 non-null   float64
 13  Brand              1234 non-null   object 
 14  Model              1234 non-null   object 
 15  Version            1234 non-null   object 
dtypes: float64(5), int64(2), object(9)
memory usage: 154.4+ KB
In [29]:
Test
Out[29]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l Brand Model Version
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 998 58.20 4.0 32.26 0.00 Maruti Alto K10 LXI CNG
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.70 796 47.30 5.0 0.00 24.70 Maruti Alto 800 2016-2019 LXI
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 2393 147.80 7.0 0.00 13.68 Toyota Innova Crysta Touring Sport 2.4 MT
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 1364 0.00 5.0 0.00 23.59 Toyota Etios Liva GD
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.50 1197 82.85 5.0 0.00 18.50 Hyundai i20 Magna
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 89411 Diesel Manual First 20.54 1598 103.60 5.0 0.00 20.54 Volkswagen Vento Diesel Trendline
1230 Volkswagen Polo GT TSI Mumbai 2015 59000 Petrol Automatic First 17.21 1197 103.60 5.0 0.00 17.21 Volkswagen Polo GT TSI
1231 Nissan Micra Diesel XV Kolkata 2012 28000 Diesel Manual First 23.08 1461 63.10 5.0 0.00 23.08 Nissan Micra Diesel XV
1232 Volkswagen Polo GT TSI Pune 2013 52262 Petrol Automatic Third 17.20 1197 103.60 5.0 0.00 17.20 Volkswagen Polo GT TSI
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 72443 Diesel Automatic First 10.00 2148 170.00 5.0 0.00 10.00 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avantgarde

1234 rows × 16 columns

In [30]:
Test.head()
Out[30]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l Brand Model Version
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 998 58.20 4.0 32.26 0.00 Maruti Alto K10 LXI CNG
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.70 796 47.30 5.0 0.00 24.70 Maruti Alto 800 2016-2019 LXI
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 2393 147.80 7.0 0.00 13.68 Toyota Innova Crysta Touring Sport 2.4 MT
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 1364 0.00 5.0 0.00 23.59 Toyota Etios Liva GD
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.50 1197 82.85 5.0 0.00 18.50 Hyundai i20 Magna
In [31]:
#creating Age of car column
Train['Age']=2020-Train['Year']
Train
Out[31]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
0 Maruti Wagon R LXI CNG Mumbai 2010 72000 CNG Manual First 26.60 998 58.16 5.0 1.75 26.6 0.00 Maruti Wagon R LXI CNG 10
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 Diesel Manual First 19.67 1582 126.20 5.0 12.50 0.0 19.67 Hyundai Creta 1.6 CRDi SX Option 5
2 Honda Jazz V Chennai 2011 46000 Petrol Manual First 18.20 1199 88.70 5.0 4.50 0.0 18.20 Honda Jazz V 9
3 Maruti Ertiga VDI Chennai 2012 87000 Diesel Manual First 20.77 1248 88.76 7.0 6.00 0.0 20.77 Maruti Ertiga VDI 8
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 Diesel Automatic Second 15.20 1968 140.80 5.0 17.74 0.0 15.20 Audi A4 New 2.0 TDI Multitronic 7
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 27365 Diesel Manual First 28.40 1248 74.00 5.0 4.75 0.0 28.40 Maruti Swift VDI 6
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 100000 Diesel Manual First 24.40 1120 71.00 5.0 4.00 0.0 24.40 Hyundai Xcent 1.1 CRDi S 5
6016 Mahindra Xylo D4 BSIV Jaipur 2012 55000 Diesel Manual Second 14.00 2498 112.00 8.0 2.90 0.0 14.00 Mahindra Xylo D4 BSIV 8
6017 Maruti Wagon R VXI Kolkata 2013 46000 Petrol Manual First 18.90 998 67.10 5.0 2.65 0.0 18.90 Maruti Wagon R VXI 7
6018 Chevrolet Beat Diesel Hyderabad 2011 47000 Diesel Manual First 25.44 936 57.60 5.0 2.50 0.0 25.44 Chevrolet Beat Diesel 9

6019 rows × 18 columns

In [32]:
#creating Age of car column
Test['Age']=2020-Test['Year']
Test
Out[32]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l Brand Model Version Age
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 998 58.20 4.0 32.26 0.00 Maruti Alto K10 LXI CNG 6
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.70 796 47.30 5.0 0.00 24.70 Maruti Alto 800 2016-2019 LXI 7
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 2393 147.80 7.0 0.00 13.68 Toyota Innova Crysta Touring Sport 2.4 MT 3
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 1364 0.00 5.0 0.00 23.59 Toyota Etios Liva GD 8
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.50 1197 82.85 5.0 0.00 18.50 Hyundai i20 Magna 6
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 89411 Diesel Manual First 20.54 1598 103.60 5.0 0.00 20.54 Volkswagen Vento Diesel Trendline 9
1230 Volkswagen Polo GT TSI Mumbai 2015 59000 Petrol Automatic First 17.21 1197 103.60 5.0 0.00 17.21 Volkswagen Polo GT TSI 5
1231 Nissan Micra Diesel XV Kolkata 2012 28000 Diesel Manual First 23.08 1461 63.10 5.0 0.00 23.08 Nissan Micra Diesel XV 8
1232 Volkswagen Polo GT TSI Pune 2013 52262 Petrol Automatic Third 17.20 1197 103.60 5.0 0.00 17.20 Volkswagen Polo GT TSI 7
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 72443 Diesel Automatic First 10.00 2148 170.00 5.0 0.00 10.00 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avantgarde 6

1234 rows × 17 columns

In [33]:
Train['Name'].unique()
Out[33]:
array(['Maruti Wagon R LXI CNG', 'Hyundai Creta 1.6 CRDi SX Option',
       'Honda Jazz V', ..., 'Volkswagen Polo IPL II 1.2 Petrol Highline',
       'Tata Bolt Revotron XT', 'Mahindra Xylo D4 BSIV'], dtype=object)
In [34]:
Test['Name'].unique()
Out[34]:
array(['Maruti Alto K10 LXI CNG', 'Maruti Alto 800 2016-2019 LXI',
       'Toyota Innova Crysta Touring Sport 2.4 MT',
       'Toyota Etios Liva GD', 'Hyundai i20 Magna',
       'Mahindra XUV500 W8 2WD', 'Toyota Fortuner 4x2 AT TRD Sportivo',
       'Hyundai EON Era Plus', 'Honda City 1.5 S MT',
       'Mahindra XUV500 W6 2WD', 'Audi Q5 2008-2012 2.0 TDI',
       'Hyundai Grand i10 Magna', 'Toyota Corolla H5',
       'Maruti Swift Vdi BSIII', 'Nissan Terrano XL', 'BMW X1 sDrive20d',
       'BMW 3 Series GT 320d Luxury Line', 'Ford Ikon 1.4 TDCi DuraTorq',
       'Maruti Swift AMT ZXI', 'Maruti Swift Dzire VXi',
       'Maruti Ritz LDi', 'Nissan Micra XV',
       'Skoda Laura 1.8 TSI Ambition',
       'Honda Civic 2010-2013 1.8 S MT Inspire', 'Ford Ikon 1.3 Flair',
       'Maruti Alto LX', 'Honda Jazz 1.5 V i DTEC',
       'Skoda Rapid 1.5 TDI AT Ambition', 'Hyundai i20 1.2 Sportz',
       'Toyota Etios Cross 1.4L VD', 'Volkswagen Polo GT TDI',
       'Hyundai i10 Era 1.1 iTech SE', 'Mitsubishi Pajero 2.8 SFX',
       'Maruti Swift Dzire Tour LDI', 'Maruti Swift Dzire VXI',
       'Skoda Rapid 1.6 MPI AT Style',
       'Hyundai Creta 1.6 SX Plus Dual Tone Petrol',
       'Toyota Innova 2.5 G (Diesel) 7 Seater BS IV',
       'BMW 5 Series 520d Luxury Line', 'Maruti Baleno Alpha 1.3',
       'Audi A4 2.0 TDI 177 Bhp Technology Edition',
       'Audi A4 2.0 TDI Multitronic', 'Skoda Rapid 1.6 MPI Ambition',
       'Maruti Ertiga SHVS VDI', 'Maruti Ciaz 1.4 Zeta',
       'Maruti Ciaz ZXi', 'Mercedes-Benz A Class A200 CDI Sport',
       'Toyota Innova 2.5 ZX Diesel 7 Seater',
       'BMW 3 Series 320d Prestige', 'Ford Ecosport 1.5 DV5 MT Titanium',
       'Ford Endeavour 3.0L 4X4 AT', 'Audi Q5 2.0 TDI',
       'Hyundai Verna 1.6 SX VTVT', 'Mahindra XUV500 W8 4WD',
       'Maruti Vitara Brezza ZDi', 'Toyota Etios Liva 1.4 VXD',
       'Tata Indigo CS LX (TDI) BS III', 'Honda City ZX GXi',
       'Toyota Corolla Altis G', 'Hyundai Grand i10 Asta',
       'Hyundai i20 Sportz 1.2', 'Volkswagen Polo 1.5 TDI Comfortline',
       'Maruti Celerio X VXI Option', 'Chevrolet Sail Hatchback 1.2',
       'Mahindra Scorpio VLX Special Edition BS-IV',
       'Volkswagen Ameo 1.5 TDI Comfortline', 'Maruti Wagon R LXI',
       'Honda Brio S Option MT', 'Maruti Ertiga VXI',
       'Hyundai Santro Xing GL', 'Ford Figo Aspire 1.2 Ti-VCT Titanium',
       'Tata Tiago AMT 1.2 Revotron XTA', 'Hyundai Santro Xing XL',
       'Chevrolet Beat LT', 'Nissan Micra Diesel XV',
       'Toyota Innova 2.5 GX (Diesel) 8 Seater',
       'Hyundai Xcent 1.2 VTVT E', 'Maruti Ciaz VXi',
       'BMW 5 Series 2013-2017 520d Luxury Line',
       'Toyota Camry Hybrid 2.5', 'Toyota Corolla Altis D-4D G',
       'Hyundai Verna 1.6 SX CRDi (O)',
       'Volkswagen Vento 1.5 TDI Highline AT', 'Nissan Teana XL',
       'Hyundai i20 1.2 Sportz Option',
       'Tata Manza Club Class Safire90 LX', 'Ford Figo Diesel ZXI',
       'Hyundai i20 Asta 1.2', 'Ford Fiesta Classic 1.6 SXI Duratec',
       'Mercedes-Benz B Class B180 Sports', 'Maruti Swift Dzire VDI',
       'Hyundai Santro Xing GLS', 'Maruti Baleno Alpha',
       'Honda Accord 2.4 Elegance M/T', 'Nissan Micra XL CVT',
       'Maruti Zen Estilo LXI BS IV', 'Hyundai Elantra CRDi SX',
       'Tata Indica V2 DiCOR DLG BS-III', 'Tata Nano Lx',
       'Honda Amaze S i-Dtech', 'Volkswagen Polo Diesel Highline 1.2L',
       'Tata Indica Vista Quadrajet LX', 'Audi Q3 30 TDI S Edition',
       'Honda City i DTEC SV', 'Honda Amaze SX i-DTEC',
       'Hyundai i20 Asta Option 1.2', 'Honda Brio S MT',
       'Mercedes-Benz New C-Class C 250 CDI Avantgarde',
       'Volkswagen Polo 1.2 MPI Highline', 'Hyundai i10 Magna AT',
       'Hyundai i20 1.2 Magna Executive', 'BMW 5 Series 525d Sedan',
       'Maruti Swift Dzire Vdi BSIV', 'Honda BRV i-DTEC V MT',
       'Maruti Swift Dzire VDI Optional', 'BMW X3 xDrive20d',
       'Chevrolet Beat Diesel LS', 'Audi Q3 30 TDI Premium FWD',
       'Mercedes-Benz GL-Class 2007 2012 350 CDI Luxury',
       'BMW 3 Series GT 320d Sport Line', 'Hyundai Grand i10 Asta Option',
       'Toyota Etios Liva VD', 'Datsun GO T Petrol',
       'Maruti Ignis 1.2 Alpha', 'Maruti A-Star Zxi',
       'Honda Civic 2010-2013 1.8 V AT Sunroof', 'Maruti Alto 800 LXI',
       'Jaguar XE 2.0L Diesel Prestige', 'Hyundai i20 1.4 CRDi Sportz',
       'Ford EcoSport 1.0 Ecoboost Titanium Plus',
       'Mahindra KUV 100 mFALCON G80 K4 5str',
       'Maruti Vitara Brezza VDi Option',
       'Volkswagen Vento Diesel Highline', 'Ford Fiesta 1.4 SXI Duratorq',
       'Fiat Avventura FIRE Dynamic', 'Honda Civic 2006-2010 1.8 V MT',
       'Honda CR-V Diesel', 'Hyundai i10 Magna',
       'Volkswagen Ameo 1.5 TDI Highline AT', 'Hyundai Accent CRDi',
       'Ford Ecosport 1.5 DV5 MT Titanium Optional',
       'Jaguar XF 2.2 Litre Luxury', 'Maruti Baleno Alpha 1.2',
       'Hyundai Grand i10 CRDi Magna', 'Hyundai EON Era',
       'Mercedes-Benz E-Class 2015-2017 E250 Edition E',
       'Mercedes-Benz M-Class ML 350 4Matic',
       'Ford EcoSport 1.5 Diesel Titanium', 'Maruti Celerio VXI AT',
       'Mahindra Xylo E9', 'Hyundai Creta 1.6 SX Automatic',
       'Honda Mobilio V i VTEC',
       'Mercedes-Benz GL-Class 350 CDI Blue Efficiency',
       'Mercedes-Benz S Class 2005 2013 S 350 L',
       'Volkswagen Vento 1.5 TDI Highline',
       'Mercedes-Benz E-Class E250 CDI Avantgrade', 'Toyota Etios V',
       'Tata Indica Vista Aqua TDI BSIII', 'Volkswagen Passat 1.8 TSI MT',
       'Maruti Alto LXi', 'Skoda Laura 1.9 TDI MT Elegance',
       'Maruti Wagon R LX', 'Nissan Sunny 2011-2014 Diesel XV',
       'Honda Brio VX', 'Hyundai i10 Sportz',
       'Mercedes-Benz M-Class ML 250 CDI',
       'Volkswagen Vento Petrol Comfortline', 'Honda Mobilio S i DTEC',
       'Maruti Alto LXI', 'Honda City ZX VTEC Plus',
       'Audi A8 L 3.0 TDI quattro', 'Maruti Swift Dzire VDi',
       'Hyundai Verna CRDi ABS', 'Tata Indica DLS', 'Tata Nano XT',
       'BMW 7 Series 730Ld DPE Signature', 'Honda Brio 1.2 S MT',
       'Hindustan Motors Contessa 2.0 DSL',
       'Renault Duster 110PS Diesel RxZ', 'Maruti Dzire ZDI',
       'Honda City i VTEC V', 'Jaguar XF Diesel',
       'BMW 3 Series 320d Luxury Line', 'BMW 3 Series Luxury Line',
       'Mercedes-Benz New C-Class C 220d Avantgarde Edition C',
       'Maruti Omni E 8 Str STD', 'Volkswagen Vento Petrol Highline',
       'Audi A6 2011-2015 2.0 TDI Premium Plus', 'Fiat Linea Dynamic',
       'Hyundai Verna 1.6 SX', 'Hyundai i20 Active 1.2 S',
       'Honda Brio V MT', 'Honda Mobilio RS Option i DTEC',
       'Mitsubishi Pajero Sport 4X4',
       'Tata Manza Club Class Quadrajet90 LS',
       'Renault Duster Adventure Edition',
       'Hyundai Verna CRDi 1.6 AT SX Plus', 'Maruti Ritz VDi',
       'Toyota Innova 2.5 V Diesel 8-seater',
       'Tata Sumo EX 10/7 Str BSII',
       'Audi Q3 35 TDI Quattro Premium Plus',
       'Fiat Grande Punto 1.2 Emotion', 'Hyundai Elantra SX',
       'Volkswagen Polo Diesel Trendline 1.2L',
       'Toyota Etios Cross 1.2L G', 'Mahindra Scorpio S4 7 Seater',
       'Maruti Ciaz VXi Plus', 'Ford Figo Petrol Titanium',
       'Mini Cooper S', 'Hyundai Creta 1.6 CRDi SX',
       'Mahindra Thar CRDe AC', 'Hyundai i10 Sportz 1.1L',
       'Maruti Wagon R LXI DUO BSIII', 'Maruti Baleno Delta CVT',
       'Maruti Alto LX BSIII', 'Hyundai Xcent 1.2 Kappa S Option',
       'Toyota Corolla Altis Diesel D4DG',
       'Volkswagen Polo Petrol Highline 1.2L', 'Hyundai i10 Era',
       'Hyundai Grand i10 1.2 Kappa Sportz',
       'Hyundai Verna 1.6 SX VTVT (O) AT', 'Ford Fiesta 1.4 SXi TDCi ABS',
       'Tata Xenon XT EX 4X2', 'Maruti Alto K10 2010-2014 VXI',
       'Audi A6 2011-2015 35 TDI Premium',
       'Renault Duster 85PS Diesel RxL Optional', 'Mahindra Thar 4X4',
       'Toyota Innova 2.5 GX (Diesel) 7 Seater', 'Chevrolet Aveo 1.6 LT',
       'Toyota Etios GD', 'Jaguar XE Portfolio',
       'Chevrolet Aveo U-VA 1.2 LS', 'Maruti Swift VDI BSIV',
       'Mercedes-Benz E-Class 2009-2013 E250 CDI Avantgarde',
       'Hyundai Accent GLE 1', 'Audi A4 New 2.0 TDI Multitronic',
       'Chevrolet Tavera LS B3 10 Seats BSIII',
       'Mahindra Xylo E8 ABS BS IV', 'Hyundai i20 Active SX Diesel',
       'Mercedes-Benz New C-Class 220 CDI AT',
       'Skoda Superb Elegance 1.8 TSI AT', 'Skoda Rapid 1.5 TDI Elegance',
       'Mercedes-Benz E-Class 2009-2013 E200 CGI Blue Efficiency',
       'Maruti 800 AC', 'Maruti Swift LDI', 'Honda BR-V i-DTEC S MT',
       'Audi A6 2011-2015 2.0 TDI Technology',
       'Toyota Fortuner 3.0 Diesel', 'Toyota Camry MT with Moonroof',
       'Maruti Ignis 1.2 Delta', 'Hyundai Verna 1.6 VTVT S',
       'Honda City V MT', 'Honda City 1.5 E MT',
       'Mahindra Verito 1.5 D4 BSIV', 'Hyundai EON D Lite Plus',
       'Toyota Innova 2.5 G (Diesel) 8 Seater', 'Maruti Ertiga VDI',
       'Audi Q7 3.0 TDI Quattro Premium Plus', 'Maruti Alto K10 LXI',
       'Tata Indica V2 eLX',
       'Mercedes-Benz New C-Class C 220 CDI Avantgarde',
       'Honda City 1.5 V MT', 'Toyota Innova 2.5 VX (Diesel) 7 Seater',
       'Hyundai i20 1.2 Magna',
       'Mercedes-Benz E-Class 2009-2013 E250 CDI Blue Efficiency',
       'Honda Accord VTi-L (AT)', 'Toyota Innova Crysta 2.4 ZX MT',
       'Hyundai i20 Asta Option 1.4 CRDi',
       'Mahindra Verito Vibe 1.5 dCi D6', 'Maruti Eeco 5 Seater AC',
       'Toyota Corolla Altis 1.8 G', 'Toyota Corolla Altis VL AT',
       'Mercedes-Benz A Class A180 Sport', 'Hyundai i20 Asta 1.4 CRDi',
       'Honda Accord 2.4 M/T', 'Honda Accord 2.4 AT',
       'Mahindra Bolero SLE BSIII', 'Honda Amaze S i-Vtech',
       'Volkswagen Jetta 2007-2011 1.6 Trendline', 'Ford Figo Petrol ZXI',
       'Toyota Innova 2.5 G (Diesel) 7 Seater',
       'Hyundai Elite i20 Asta Option', 'Mahindra KUV 100 mFALCON D75 K2',
       'Bentley Flying Spur W12', 'Toyota Fortuner 2.8 2WD MT',
       'Tata Indica V2 DLS BSIII', 'Nissan Micra Active XV',
       'Hyundai Grand i10 Sportz', 'Tata Tigor 1.2 Revotron XZ Option',
       'Honda Accord 2001-2003 2.3 VTI L MT', 'Mahindra Xylo E4',
       'Land Rover Freelander 2 S Business Edition',
       'Tata Indigo eCS eLX BS IV', 'Fiat Linea Emotion (Diesel)',
       'Tata Tiago 1.2 Revotron XZ',
       'Volkswagen Polo Diesel Comfortline 1.2L',
       'Maruti Wagon R VXI BS IV', 'Hyundai Creta 1.6 CRDi AT SX Plus',
       'Audi A4 35 TDI Technology', 'BMW X1 xDrive 20d xLine',
       'Ford Endeavour 3.0L AT 4x2', 'Maruti Vitara Brezza LDi',
       'Mercedes-Benz New C-Class 200 K AT',
       'Volvo XC90 2007-2015 D5 AWD', 'Nissan Teana 230jM',
       'Hyundai Santro Xing GLS CNG', 'BMW X6 xDrive30d',
       'Tata Indigo CS eVX', 'Audi Q5 30 TDI quattro Premium Plus',
       'Hyundai i10 Sportz 1.2', 'Maruti Baleno Delta 1.2',
       'Maruti Swift VDI', 'Toyota Land Cruiser Prado VX L',
       'Hyundai Tucson 2.0 e-VGT 4WD AT GLS', 'Maruti Baleno Delta',
       'Audi A4 2.0 TDI', 'Maruti Dzire AMT ZXI Plus',
       'Toyota Innova 2.5 GX 8 STR', 'Maruti Wagon R VXI AMT Opt',
       'Skoda Laura L and K MT', 'Maruti Swift LXI Option',
       'Maruti Omni MPI CARGO BSIV', 'Honda Amaze S AT i-Vtech',
       'Toyota Corolla H2', 'Chevrolet Spark 1.0 LT',
       'Audi Q3 2012-2015 2.0 TDI Quattro Premium Plus',
       'Chevrolet Cruze LTZ AT', 'Hyundai Xcent 1.2 Kappa AT SX Option',
       'Nissan Terrano XV D Pre', 'Ford Ecosport 1.5 DV5 MT Ambiente',
       'Land Rover Range Rover HSE', 'Toyota Etios G',
       'Volkswagen Polo ALLSTAR 1.2 MPI',
       'Toyota Innova 2.5 VX (Diesel) 7 Seater BS IV',
       'Hyundai Verna CRDi 1.6 SX Option',
       'Land Rover Discovery 4 SDV6 SE', 'Honda City i DTec VX Option BL',
       'Nissan Micra XV CVT', 'Hyundai Santro GLS I - Euro II',
       'Maruti Vitara Brezza ZDi Plus Dual Tone', 'Honda Accord 2.4 A/T',
       'Maruti Swift VDI BSIV W ABS',
       'Mercedes-Benz GLC 220d 4MATIC Sport', 'Mahindra Xylo D4 BSIV',
       'Datsun GO Plus T Petrol', 'Maruti SX4 VDI', 'Maruti Celerio VXI',
       'Volkswagen Vento 1.5 TDI Comfortline AT',
       'Ford EcoSport 1.5 TDCi Titanium',
       'Hyundai Santro LS zipDrive Euro I', 'Honda Brio VX AT',
       'Mitsubishi Pajero Sport 4X2 AT', 'Maruti Swift VDI Optional',
       'Hyundai Accent GLE', 'BMW 3 Series 320d Sport',
       'Renault KWID Climber 1.0 AMT', 'Mahindra Bolero VLX CRDe',
       'Hyundai Creta 1.6 SX Diesel',
       'Volkswagen Passat Diesel Highline 2.0 TDI',
       'Isuzu MU 7 4x2 HIPACK',
       'Mercedes-Benz E-Class 2015-2017 E250 CDI Avantgarde',
       'Nissan Sunny 2011-2014 XL', 'Hyundai Elantra GT',
       'Honda Accord VTi-L AT', 'Toyota Fortuner 4x4 MT',
       'Mini Cooper 3 DOOR D', 'Chevrolet Beat LS',
       'Mercedes-Benz B Class B180 Sport',
       'Audi Q5 2008-2012 2.0 TFSI Quattro',
       'Skoda Laura 1.9 TDI AT Ambiente',
       'Hyundai Creta 1.6 CRDi SX Option', 'BMW 7 Series 730Ld',
       'Skoda Laura Ambiente 2.0 TDI CR AT', 'Hyundai i20 1.4 CRDi Magna',
       'Maruti A-Star AT Vxi Aktiv', 'Hyundai Verna 1.6 VTVT',
       'BMW 3 Series 320d', 'Maruti Zen Estilo VXI BSIII',
       'Audi Q3 2012-2015 35 TDI Quattro Premium', 'Honda Brio E MT',
       'Mahindra Bolero SLX', 'Maruti Celerio ZDi', 'Hyundai Getz GVS',
       'Hyundai Xcent 1.2 CRDi SX',
       'Ford EcoSport 1.5 Ti VCT AT Titanium',
       'BMW 5 Series 530i Sport Line', 'Maruti Wagon R VXI 1.2',
       'Chevrolet Optra Magnum 2.0 LT', 'Renault KWID RXL',
       'Volkswagen Jetta 2013-2015 2.0L TDI Highline',
       'Ford Figo Diesel Titanium', 'Chevrolet Spark 1.0 LS',
       'Honda Jazz VX CVT', 'Chevrolet Cruze LTZ',
       'Skoda Rapid 1.6 MPI AT Style Plus', 'Maruti Ritz ZXi',
       'Honda City 1.5 S AT', 'Tata Indica Vista Aqua 1.2 Safire',
       'Toyota Etios Liva Diesel TRD Sportivo',
       'Skoda Rapid Ultima 1.6 TDI Ambition Plus', 'Maruti SX4 ZXI AT',
       'Hyundai i20 new Sportz AT 1.4',
       'Mahindra Scorpio SLX 2.6 Turbo 8 Str', 'Maruti Baleno Zeta 1.2',
       'BMW X3 2.5si', 'Hyundai EON 1.0 Kappa Magna Plus',
       'Chevrolet Enjoy 1.3 TCDi LTZ 7', 'Hyundai Verna 1.6 CRDi EX AT',
       'Honda BRV i-VTEC V CVT', 'Hyundai i10 Magna 1.2',
       'Toyota Innova 2.5 G4 Diesel 8-seater', 'Hyundai Verna 1.4 CX',
       'Hyundai i20 Sportz AT 1.4', 'Hyundai Verna 1.6 EX VTVT',
       'Hyundai i20 Magna Optional 1.2',
       'Toyota Innova 2.5 VX (Diesel) 8 Seater',
       'Mahindra KUV 100 D75 K8 5Str', 'Honda City i VTEC CVT VX',
       'Maruti Alto K10 VXI', 'Maruti Wagon R VXI Minor',
       'Mahindra TUV 300 2015-2019 T8', 'Hyundai Santro LS zipPlus',
       'Tata New Safari DICOR 2.2 EX 4x2', 'Audi A6 2011-2015 2.0 TDI',
       'Nissan Sunny Diesel XV', 'Toyota Innova 2.5 G4 Diesel 7-seater',
       'Renault Duster 110PS Diesel RxL', 'Maruti Dzire VXI',
       'Jeep Compass 2.0 Limited Option 4X4', 'Ford Fiesta 1.4 SXi TDCi',
       'Skoda Superb L&K 2.0 TDI AT', 'Mahindra Xylo E8',
       'Hyundai EON 1.0 Era Plus', 'Hyundai Elantra 2.0 SX Option AT',
       'Toyota Innova 2.0 V', 'Mahindra Xylo H9',
       'Hyundai Verna VTVT 1.6 SX', 'Hyundai Verna 1.6 CRDI',
       'Nissan Sunny 2011-2014 Diesel XL',
       'Chevrolet Sail Hatchback LS ABS', 'Hyundai Santro Xing GL Plus',
       'Nissan Sunny 2011-2014 XL AT Special Edition',
       'Honda Brio 1.2 VX MT', 'Honda CR-V 2.4 4WD AT',
       'Mercedes-Benz New C-Class C 220 CDI Celebration Edition',
       'Ford Ecosport 1.0 Ecoboost Titanium', 'Mercedes-Benz GLE 250d',
       'Toyota Fortuner 4x4 MT TRD Sportivo',
       'Mercedes-Benz CLA 200 D Sport Edition',
       'Honda Jazz 1.2 V CVT i VTEC', 'Toyota Fortuner 4x2 AT',
       'Mercedes-Benz E-Class 2009-2013 E350 CDI Avantgarde',
       'Mahindra TUV 300 P4', 'Volkswagen Polo 1.5 TDI Highline',
       'Maruti Wagon R LXI BS IV', 'Toyota Innova Crysta 2.8 ZX AT',
       'Maruti Ritz VDi ABS', 'Honda Jazz 1.2 VX i VTEC',
       'BMW 5 Series 520d Sedan', 'Hyundai Creta 1.4 CRDi S Plus',
       'Hyundai Getz GLE', 'Hyundai Xcent 1.2 Kappa SX Option',
       'Maruti Swift 1.3 VXi', 'Volvo S60 D5 Kinetic',
       'Honda Mobilio V i DTEC', 'Renault Captur 1.5 Diesel RXL',
       'Hyundai EON Sportz', 'Maruti A-Star AT VXI',
       'Audi A3 35 TDI Attraction', 'BMW 5 Series 2013-2017 530d M Sport',
       'Chevrolet Enjoy TCDi LS 7 Seater',
       'Mahindra Scorpio S10 8 Seater', 'Hyundai i20 2015-2017 1.2 Magna',
       'Renault Pulse RxZ', 'Maruti Swift Dzire ZDI',
       'Hyundai EON Magna Plus', 'Nissan Micra XL', 'Maruti Swift VXI',
       'Skoda Rapid 1.6 TDI Ambition', 'Fiat Punto 1.4 Emotion',
       'Honda Jazz 1.5 S i DTEC', 'Volvo XC60 D4 SUMMUM',
       'Maruti Ciaz ZDi Plus SHVS', 'Hyundai i20 1.4 CRDi Asta',
       'Maruti Omni 5 Seater BSIV', 'Hyundai Verna CRDi SX ABS',
       'Maruti Baleno Sigma 1.2', 'BMW X3 xDrive20d Advantage Edition',
       'Skoda Superb Style 1.8 TSI AT', 'Renault Duster 85PS Diesel RxL',
       'Honda WRV i-DTEC VX', 'Mercedes-Benz E-Class E 220 d',
       'Mercedes-Benz S Class 2005 2013 S 350 CDI', 'Hyundai Accent GLX',
       'Maruti Swift VXI BSIV', 'Mahindra KUV 100 G80 K4 Plus 5Str',
       'Tata Indica Vista Terra 1.2 Safire BS IV',
       'Land Rover Discovery Sport TD4 S',
       'Volkswagen Vento 1.5 TDI Highline Plus',
       'Tata Indica Vista TDI LS', 'Ford Figo Diesel LXI',
       'Honda Jazz 1.2 V i VTEC', 'Hyundai Grand i10 1.2 CRDi Magna',
       'Skoda Rapid 1.5 TDI Ambition',
       'Ford Ecosport 1.5 Ti VCT AT Titanium',
       'Hyundai Creta 1.6 SX Automatic Diesel',
       'Volkswagen CrossPolo 1.2 TDI', 'Ford Ikon 1.4 ZXi',
       'Porsche Cayenne Diesel', 'Honda Amaze E i-Vtech',
       'Audi A3 35 TDI Premium Plus',
       'Hyundai Verna Transform SX VGT CRDi BS III',
       'Ford Ecosport 1.5 DV5 MT Trend', 'Honda Amaze SX i-VTEC',
       'Volkswagen Vento 1.5 TDI Highline Plus AT',
       'Maruti SX4 S Cross DDiS 200 Zeta', 'Maruti 800 DX',
       'Toyota Innova Crysta 2.8 GX AT 8S', 'Maruti Ertiga VXI Petrol',
       'Maruti A-Star Vxi',
       'Fiat Avventura Urban Cross 1.3 Multijet Emotion',
       'Ford Fiesta 1.4 Duratec EXI Limited Edition',
       'Hyundai Elantra CRDi SX AT', 'Honda Accord 2.4 Elegance A/T',
       'Maruti Wagon R VXI AMT', 'Hyundai i20 1.2 Era',
       'Tata Nano Cx BSIV', 'Ford Ecosport 1.5 Ti VCT MT Trend',
       'Skoda Octavia Classic 1.9 TDI MT', 'Hyundai i20 Magna 1.2',
       'Maruti SX4 Vxi BSIV', 'Maruti Ritz LXi',
       'Maruti Alto K10 LXI CNG Optional',
       'Hyundai i20 2015-2017 Sportz AT 1.4',
       'Toyota Innova Crysta 2.4 G MT 8S', 'Mahindra Quanto C2',
       'Skoda Octavia 2.0 TDI MT Style', 'Hyundai Grand i10 AT Asta',
       'Hyundai i20 Magna 1.4 CRDi', 'Volvo S80 D5',
       'Renault Duster 85PS Diesel RxZ', 'Maruti Swift VXI BSIII',
       'Hyundai Creta 1.6 SX Plus Diesel',
       'Tata Tiago 1.2 Revotron XT Option', 'Audi A6 35 TDI Matrix',
       'Jaguar XF 2.0 Petrol Portfolio', 'Tata Manza Aqua Safire',
       'Tata Nano XTA', 'Maruti Wagon R AMT VXI',
       'Honda Civic 2010-2013 1.8 V AT', 'BMW 7 Series 2007-2012 730Ld',
       'Mahindra XUV500 AT W10 FWD', 'Hyundai Elantra SX AT',
       'Honda City i-DTEC SV', 'Volkswagen Polo Petrol Comfortline 1.2L',
       'Nissan 370Z AT', 'BMW 6 Series Gran Coupe',
       'Hyundai i20 1.4 Sportz', 'Hyundai Sonata Embera 2.0L CRDi MT',
       'Audi A6 2011-2015 35 TDI Technology',
       'Ford Classic 1.4 Duratorq CLXI', 'Renault Koleos 4X2 MT',
       'Land Rover Freelander 2 TD4 SE', 'Honda Amaze E i-DTEC',
       'Volvo V40 Cross Country D3', 'Ford Figo 1.2P Titanium MT',
       'Maruti Ciaz VDi Option SHVS',
       'Tata Indica Vista Terra Quadrajet 1.3L BS IV',
       'Hyundai EON Magna', 'Mahindra KUV 100 mFALCON G80 K6 Plus',
       'Hyundai i20 1.2 Spotz', 'Mercedes-Benz GLA Class 220 d 4MATIC',
       'Maruti Wagon R Stingray LXI', 'Mahindra Bolero Power Plus ZLX',
       'Tata Indica Vista Aura 1.3 Quadrajet',
       'Hyundai Elite i20 Petrol Sportz', 'Toyota Qualis FS B3',
       'Maruti Swift Dzire LXI', 'Fiat Linea Classic 1.3 Multijet',
       'Hyundai i20 1.2 Asta', 'Ford Endeavour 2.2 Titanium AT 4X2',
       'Mahindra Scorpio VLS 2.2 mHawk', 'Maruti Ciaz VDi',
       'Audi A4 35 TDI Premium Plus',
       'Ford Freestyle Titanium Plus Diesel',
       'Hyundai EON D Lite Plus Option', 'Maruti Wagon R VXI',
       'Ford EcoSport 1.5 Ti VCT MT Titanium',
       'Renault Duster 110PS Diesel RxZ AMT', 'Maruti Swift VVT ZXI',
       'Mahindra Xylo D4', 'Toyota Etios Liva V', 'Honda CR-V 2.4 AT',
       'Fiat Punto EVO 1.3 Emotion', 'Fiat Abarth 595 Competizione',
       'Ford Ecosport 1.0 Ecoboost Platinum Edition',
       'Jaguar XF 3.0 Litre S Premium Luxury',
       'Mercedes-Benz M-Class ML 320 CDI',
       'Toyota Innova 2.5 V Diesel 7-seater',
       'Volkswagen Polo 1.2 MPI Comfortline',
       'Hyundai Accent Executive LPG', 'ISUZU D-MAX V-Cross 4X4',
       'Honda BR-V i-VTEC VX MT',
       'Mercedes-Benz B Class 2012-2015 B200 Sport CDI',
       'Maruti Eeco 5 STR With AC Plus HTR CNG',
       'Volkswagen Vento 1.6 Trendline', 'Maruti Versa DX2',
       'Maruti Swift Dzire 1.2 Lxi BSIV',
       'Volkswagen Vento Diesel Trendline', 'Hyundai Elantra 1.6 SX',
       'Datsun redi-GO T Option', 'Honda City i DTec SV',
       'Mercedes-Benz New C-Class C 250 CDI Elegance',
       'Hyundai Sonata Embera 2.4L MT', 'Toyota Etios Liva G',
       'Hyundai Verna 1.6 VTVT EX AT', 'Honda Amaze VX CVT i-VTEC',
       'Hyundai Sonata Transform 2.4 GDi AT', 'Honda Jazz 2020 Petrol',
       'Maruti Alto 800 CNG LXI', 'Mercedes-Benz SLC 43 AMG',
       'Toyota Fortuner 4x2 4 Speed AT',
       'Mahindra Scorpio VLX 2WD Airbag BSIII', 'Mercedes-Benz GLE 350d',
       'BMW 5 Series 2003-2012 520d', 'Maruti SX4 Zxi BSIII',
       'Hyundai i20 1.4 Asta AT (O) with Sunroof',
       'Hyundai Xcent 1.1 CRDi S', 'Renault Lodgy 110PS RxL',
       'Honda City i DTec VX', 'Audi A4 3.0 TDI Quattro Premium',
       'Mercedes-Benz E-Class 250 D W 124',
       'Toyota Innova 2.5 LE 2014 Diesel 8 Seater',
       'Volkswagen Jetta 2007-2011 2.0 TDI Trendline',
       'Mahindra Bolero ZLX', 'Hyundai Grand i10 1.2 CRDi Sportz',
       'Maruti Baleno Zeta 1.3', 'Mercedes-Benz E-Class E240 V6 AT',
       'Nissan Terrano XE 85 PS', 'Mercedes-Benz New C-Class C 200 CGI',
       'Honda City 1.5 V MT Sunroof',
       'Toyota Innova 2.5 GX (Diesel) 8 Seater BS IV',
       'BMW 5 Series 2007-2010 525d Sedan', 'Volkswagen Polo GT TSI',
       'Mahindra TUV 300 2015-2019 T8 AMT',
       'Mercedes-Benz New C-Class C 220 CDI CLASSIC',
       'Maruti Swift Dzire Ldi BSIV', 'Toyota Innova Crysta 2.4 VX MT 8S',
       'Maruti SX4 ZDI', 'Hyundai Verna 1.4 CRDi',
       'Honda Amaze EX i-Vtech',
       'Audi A4 2.0 TDI Premium Sport Limited Edition',
       'Tata Tigor 1.2 Revotron XT',
       'Hyundai i20 2015-2017 1.4 CRDi Sportz',
       'Mercedes-Benz E-Class E250 CDI Launch Edition',
       'Ford Fiesta Classic 1.4 Duratorq CLXI',
       'Hyundai Creta 1.6 VTVT Base', 'Maruti Ignis 1.2 AMT Delta',
       'Honda City i-VTEC CVT ZX', 'Ford Fiesta Classic 1.6 Duratec LXI',
       'Toyota Corolla Executive (HE)', 'Maruti Alto LXi BSIII',
       'Maruti Ciaz VDi Plus', 'Maruti Ciaz 1.3 Alpha',
       'Renault Pulse RxL', 'BMW 6 Series 650i Coupe',
       'Tata Indigo eCS LX BSIV', 'Mercedes-Benz A Class A180 CDI',
       'Toyota Corolla Altis GL', 'Honda Civic 2006-2010 1.8 (E) MT',
       'OpelCorsa 1.4Gsi', 'Hyundai Creta 1.6 VTVT S',
       'Volkswagen Ameo 1.5 TDI Highline',
       'Hyundai Grand i10 CRDi Sportz', 'Maruti Swift Dzire AMT ZDI',
       'Hyundai Grand i10 1.2 Kappa Sportz AT',
       'Hyundai Grand i10 1.2 Kappa Magna',
       'Maruti Swift VDi BSIII W/ ABS', 'Maruti Ciaz RS ZDi Plus SHVS',
       'Volkswagen Vento 1.2 TSI Comfortline AT',
       'Skoda Laura Ambition 2.0 TDI CR AT',
       'Hyundai Xcent 1.1 CRDi S Celebration Edition',
       'Mercedes-Benz New C-Class C 200 CGI Elegance',
       'Hyundai Santro Xing XG AT eRLX Euro III',
       'Maruti Swift Dzire VXI Optional',
       'Audi Q5 3.0 TDI Quattro Technology',
       'Mahindra KUV 100 mFALCON D75 K6 5str AW',
       'Tata Tiago 1.2 Revotron XT', 'Mahindra Scorpio VLX 2WD BSIII',
       'Toyota Innova Crysta 2.8 GX AT', 'Maruti Wagon R VXI BSIII',
       'Honda Civic 2006-2010 1.8 MT Sport', 'Mahindra Thar CRDe',
       'Tata Zest Revotron 1.2T XE', 'Mahindra Ssangyong Rexton RX7',
       'Tata Zest Quadrajet 1.3 75PS XE',
       'Chevrolet Enjoy Petrol LTZ 7 Seater',
       'Skoda Superb Elegance 2.0 TDI CR AT',
       'Hyundai i20 2015-2017 Magna Optional 1.4 CRDi',
       'Mahindra Scorpio S6 Plus 7 Seater', 'Mercedes-Benz CLA 45 AMG',
       'Toyota Camry 2.5 G', 'Audi Q5 2008-2012 3.0 TDI Quattro',
       'Maruti Esteem Vxi - BSIII', 'Jeep Compass 2.0 Longitude',
       'Honda City 1.5 V AT', 'Mini Clubman Cooper S',
       'Honda City ZX EXi', 'Chevrolet Spark 1.0 PS',
       'Chevrolet Enjoy 1.4 LTZ 8', 'Fiat Grande Punto 1.4 Emotion',
       'Maruti Vitara Brezza ZDi AMT', 'Hyundai i20 1.4 Asta (AT)',
       'Hyundai Elantra CRDi', 'Mahindra XUV500 W10 2WD',
       'Audi A6 2.0 TDI Design Edition',
       'Tata Tiago 1.2 Revotron XZ WO Alloy',
       'Mercedes-Benz A Class Edition 1', 'BMW 7 Series 740i Sedan',
       'Land Rover Range Rover 2.2L Pure',
       'Hyundai Creta 1.6 SX Plus Petrol Automatic',
       'Volkswagen Vento 1.2 TSI Highline AT', 'Mini Cooper Countryman D',
       'Volvo S60 D4 KINETIC', 'Maruti Ertiga ZXI',
       'Mercedes-Benz New C-Class C 220 CDI Style',
       'Maruti Swift Dzire 1.2 Vxi BSIV',
       'Mercedes-Benz GLA Class 200 CDI SPORT',
       'Honda City i VTEC VX Option', 'Maruti Alto LXi BSII',
       'Hyundai Elite i20 Petrol Asta', 'Honda Amaze VX i-DTEC',
       'Volkswagen Jetta 2007-2011 2.0 TDI Comfortline',
       'Mercedes-Benz S Class 2005 2013 320 L',
       'Maruti Zen Estilo LXI BSIII', 'Hyundai Verna CRDi SX',
       'Hyundai Verna VTVT 1.6 AT SX Option', 'Maruti Baleno Vxi - BSIII',
       'Volkswagen Vento Diesel Comfortline', 'Hyundai i10 Magna 1.1L',
       'Jeep Compass 2.0 Sport', 'Hyundai i10 Era 1.1',
       'Maruti Alto XCITE', 'Ford Figo Diesel EXI',
       'Land Rover Discovery 4 TDV6 Auto Diesel',
       'Hyundai Grand i10 1.2 Kappa Sportz Option',
       'Hyundai i20 Sportz Option 1.2',
       'Hyundai Verna Transform VTVT with Audio', 'Honda City i VTEC VX',
       'Tata Indica Vista Quadrajet LS', 'Hyundai i20 Active 1.4 SX',
       'BMW X5 xDrive 30d Design Pure Experience 5 Seater',
       'Maruti Vitara Brezza ZDi Plus AMT', 'Ford Fiesta 1.4 Duratec EXI',
       'Maruti Dzire AMT VDI', 'Honda City i-VTEC VX',
       'Chevrolet Captiva LT', 'Skoda Superb Petrol Ambition',
       'Mahindra Renault Logan 1.5 DLE Diesel',
       'Tata Tiago 1.05 Revotorq XT Option',
       'Volkswagen Vento Petrol Highline AT',
       'Ford EcoSport 1.5 Petrol Ambiente', 'Jeep Compass 1.4 Sport',
       'Hyundai Verna 1.6 SX VTVT (O)', 'Hyundai Elite i20 Magna Plus',
       'Honda Amaze VX AT i-Vtech', 'Chevrolet Aveo 1.4 LS',
       'Mercedes-Benz E-Class 2009-2013 E 220 CDI Avantgarde'],
      dtype=object)
In [35]:
Train[Train['Mileage'].isnull()]
Out[35]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
In [36]:
Train[Train['Power'].isnull()]
Out[36]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
In [37]:
Train['Name'].value_counts()
Out[37]:
Mahindra XUV500 W8 2WD                 49
Maruti Swift VDI                       45
Honda City 1.5 S MT                    34
Maruti Swift Dzire VDI                 34
Maruti Swift VDI BSIV                  31
                                       ..
Fiat Petra 1.2 EL                       1
Volkswagen Polo 1.0 MPI Comfortline     1
Fiat Siena 1.2 ELX                      1
Mahindra Scorpio VLX 2WD AT BSIV        1
Volkswagen Vento Diesel Breeze          1
Name: Name, Length: 1876, dtype: int64
In [38]:
Test['Name'].value_counts()
Out[38]:
Maruti Alto LXi                     9
Volkswagen Polo 1.2 MPI Highline    8
Maruti Swift Dzire VDI              8
Honda City 1.5 V MT                 8
Hyundai i10 Magna                   7
                                   ..
Volvo XC60 D4 SUMMUM                1
Maruti Swift VVT ZXI                1
Mahindra Xylo E9                    1
Honda Accord VTi-L (AT)             1
Hyundai Elantra 1.6 SX              1
Name: Name, Length: 768, dtype: int64

EDA And Visualization

Droping outliners

In [39]:
#removing outliners
print(Train[Train['Seats']<2])
Train.drop(Train[Train['Seats']<2].index,inplace= True)
Train[Train['Seats']<2]
                                   Name   Location  Year  Kilometers_Driven  \
3999  Audi A4 3.2 FSI Tiptronic Quattro  Hyderabad  2012             125000   

     Fuel_Type Transmission Owner_Type  Mileage Engine  Power  Seats  Price  \
3999    Petrol    Automatic      First     10.5  3197     0.0    0.0   18.0   

      Mileage_per_kg  Mileage_per_l Brand Model                    Version  \
3999             0.0           10.5  Audi    A4  3.2 FSI Tiptronic Quattro   

      Age  
3999    8  
Out[39]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
In [40]:
Train[Train['Price']>100]
Out[40]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
4079 Land Rover Range Rover 3.0 Diesel LWB Vogue Hyderabad 2017 25000 Diesel Automatic First 13.33 2993 255.0 5.0 160.0 0.0 13.33 Land Rover Range Rover 3.0 Diesel LWB 3
5781 Lamborghini Gallardo Coupe Delhi 2011 6500 Petrol Automatic Third 6.40 5204 560.0 2.0 120.0 0.0 6.40 Lamborghini Gallardo Coupe 9
In [41]:
#Droping Outliners
Train=Train.drop(Train[Train['Price']>100].index)
Train.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 6016 entries, 0 to 6018
Data columns (total 18 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Name               6016 non-null   object 
 1   Location           6016 non-null   object 
 2   Year               6016 non-null   int64  
 3   Kilometers_Driven  6016 non-null   int64  
 4   Fuel_Type          6016 non-null   object 
 5   Transmission       6016 non-null   object 
 6   Owner_Type         6016 non-null   object 
 7   Mileage            6016 non-null   float64
 8   Engine             6016 non-null   object 
 9   Power              6016 non-null   float64
 10  Seats              6016 non-null   float64
 11  Price              6016 non-null   float64
 12  Mileage_per_kg     6016 non-null   float64
 13  Mileage_per_l      6016 non-null   float64
 14  Brand              6016 non-null   object 
 15  Model              6016 non-null   object 
 16  Version            6016 non-null   object 
 17  Age                6016 non-null   int64  
dtypes: float64(6), int64(3), object(9)
memory usage: 893.0+ KB
In [42]:
Train.describe()
Out[42]:
Year Kilometers_Driven Mileage Power Seats Price Mileage_per_kg Mileage_per_l Age
count 6016.000000 6.016000e+03 6016.000000 6016.000000 6016.000000 6016.000000 6016.000000 6016.000000 6016.000000
mean 2013.358211 5.874166e+04 18.138602 110.924854 5.278258 9.434661 0.268826 17.864124 6.641789
std 3.270032 9.128408e+04 4.578740 55.029682 0.802552 10.927967 2.633292 4.872972 3.270032
min 1998.000000 1.710000e+02 0.000000 0.000000 2.000000 0.440000 0.000000 0.000000 1.000000
25% 2011.000000 3.400000e+04 15.200000 74.000000 5.000000 3.500000 0.000000 15.100000 4.000000
50% 2014.000000 5.300000e+04 18.155000 91.100000 5.000000 5.635000 0.000000 18.000000 6.000000
75% 2016.000000 7.300000e+04 21.100000 138.030000 5.000000 9.950000 0.000000 20.920000 9.000000
max 2019.000000 6.500000e+06 33.540000 552.000000 10.000000 100.000000 33.540000 28.400000 22.000000
In [43]:
Train[Train['Kilometers_Driven']>800000]
Out[43]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
2328 BMW X5 xDrive 30d M Sport Chennai 2017 6500000 Diesel Automatic First 15.97 2993 258.0 5.0 65.0 0.0 15.97 BMW X5 xDrive 30d M Sport 3
In [44]:
Train=Train.drop(Train[Train['Kilometers_Driven']>800000].index)
In [45]:
Train['Year'].value_counts().plot.bar()
Out[45]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb623adfc8>
In [46]:
Train['Fuel_Type'].value_counts().plot.bar()
Out[46]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb62505948>
In [47]:
Train['Owner_Type'].value_counts().plot.bar()
Out[47]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb624d5ec8>
In [48]:
Train['Location'].value_counts().plot.bar()
Out[48]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb62423f88>
In [49]:
Train.Price.sort_values(ascending=False)
Out[49]:
5919    100.00
1505     97.07
1974     93.67
1984     93.00
4691     90.00
         ...  
3228      0.50
3138      0.45
1628      0.45
2847      0.45
1713      0.44
Name: Price, Length: 6015, dtype: float64
In [50]:
Train.Price.mean()
Out[50]:
9.425423108894414
In [51]:
Train[Train.Price>9.47]
Out[51]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 41000 Diesel Manual First 19.67 1582 126.20 5.0 12.50 0.0 19.67 Hyundai Creta 1.6 CRDi SX Option 5
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 40670 Diesel Automatic Second 15.20 1968 140.80 5.0 17.74 0.0 15.20 Audi A4 New 2.0 TDI Multitronic 7
7 Toyota Innova Crysta 2.8 GX AT 8S Mumbai 2016 36000 Diesel Automatic First 11.36 2755 171.50 8.0 17.50 0.0 11.36 Toyota Innova Crysta 2.8 GX AT 8S 4
10 Maruti Ciaz Zeta Kochi 2018 25692 Petrol Manual First 21.56 1462 103.25 5.0 9.95 0.0 21.56 Maruti Ciaz Zeta 2
13 Land Rover Range Rover 2.2L Pure Delhi 2014 72000 Diesel Automatic First 12.70 2179 187.70 5.0 27.00 0.0 12.70 Land Rover Range Rover 2.2L Pure 6
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6001 Audi A6 2011-2015 2.0 TDI Kochi 2013 91903 Diesel Automatic First 17.68 1968 174.33 5.0 17.56 0.0 17.68 Audi A6 2011-2015 2.0 TDI 7
6006 Mercedes-Benz M-Class ML 320 CDI Mumbai 2009 102002 Diesel Automatic First 8.70 2987 224.34 5.0 10.75 0.0 8.70 Mercedes-Benz M-Class ML 320 CDI 11
6008 Porsche Panamera Diesel Hyderabad 2013 40000 Diesel Automatic Second 17.85 2967 300.00 4.0 45.00 0.0 17.85 Porsche Panamera Diesel 7
6009 Toyota Camry Hybrid Mumbai 2015 33500 Petrol Automatic First 19.16 2494 158.20 5.0 19.75 0.0 19.16 Toyota Camry Hybrid 5
6012 Toyota Innova 2.5 V Diesel 7-seater Coimbatore 2011 45004 Diesel Manual First 12.80 2494 102.00 7.0 9.48 0.0 12.80 Toyota Innova 2.5 V Diesel 7-seater 9

1585 rows × 18 columns

In [52]:
Train.Mileage.sort_values()
Out[52]:
3061     0.00
67       0.00
5022     0.00
307      0.00
1460     0.00
        ...  
4141    33.54
2059    33.54
3129    33.54
2371    33.54
1332    33.54
Name: Mileage, Length: 6015, dtype: float64
In [53]:
pd.crosstab(Train.Location, Train.Owner_Type)
Out[53]:
Owner_Type First Fourth & Above Second Third
Location
Ahmedabad 186 0 38 0
Bangalore 231 1 114 12
Chennai 334 2 121 36
Coimbatore 571 1 63 1
Delhi 457 0 94 2
Hyderabad 656 0 84 0
Jaipur 300 1 97 15
Kochi 614 0 34 3
Kolkata 503 0 32 0
Mumbai 653 2 121 14
Pune 421 2 170 29
In [54]:
Train['Location'].value_counts(normalize=True)
Out[54]:
Mumbai        0.131338
Hyderabad     0.123026
Kochi         0.108229
Coimbatore    0.105736
Pune          0.103408
Delhi         0.091937
Kolkata       0.088944
Chennai       0.081962
Jaipur        0.068662
Bangalore     0.059518
Ahmedabad     0.037240
Name: Location, dtype: float64
Plots
In [55]:
sns.distplot(Train["Year"])
Out[55]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb623a3f08>
In [56]:
sns.distplot(Train["Price"])
Out[56]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb62381708>
In [57]:
plt.figure(figsize=(20,5))
sns.boxplot(
    data=Train,
    x='Fuel_Type',y='Price',
    )
Out[57]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb629ce748>
In [58]:
#Price of car vs Locations
plt.figure(figsize=(15,10))
sns.boxplot(x=Train['Location'],y=Train['Price'],data=Train,hue=Train['Fuel_Type'])
Out[58]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb63abbc08>
In [59]:
#No. of cars from different Brands
plt.figure(figsize = (12, 8))
plot = sns.countplot(x = 'Brand', data = Train)
plt.xticks(rotation = 90)
for p in plot.patches:
    plot.annotate(p.get_height(), 
                        (p.get_x() + p.get_width() / 2.0, 
                         p.get_height()), 
                        ha = 'center', 
                        va = 'center', 
                        xytext = (0, 5),
                        textcoords = 'offset points')

plt.title("Count of cars based on Brands")
plt.xlabel("Car Brand")
plt.ylabel("Count of cars")
Out[59]:
Text(0, 0.5, 'Count of cars')
In [60]:
plt.figure(figsize=(20,5))
sns.boxplot(
    data=Train,
    x='Transmission',y='Price',
   )
Out[60]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb62a06b08>
In [61]:
plt.figure(figsize=(20,5))
sns.boxplot(
    data=Train,
    x='Owner_Type',y='Price',
    color='red')
Out[61]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb626c3c08>
In [62]:
plt.figure(figsize=(20,5))
sns.boxplot(
    data=Train,
    x='Location',y='Price',
    color='red')
Out[62]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb626f2d08>
In [63]:
sns.jointplot(x='Price',y='Kilometers_Driven',data=Train,kind='hex')
Out[63]:
<seaborn.axisgrid.JointGrid at 0x1fb62741c88>
In [64]:
sns.set(style="white", palette="muted", color_codes=True)
Train['Year'].hist(bins=30)
Out[64]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb627c9608>
In [65]:
Train['Mileage'].hist(bins=30)  
Out[65]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb625d0c88>
In [66]:
sns.violinplot(y='Price',data=Train)
Out[66]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb622d4848>
In [67]:
sns.boxplot(y='Kilometers_Driven',data=Train)
Out[67]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb61e6cc48>
In [68]:
sns.jointplot(x='Price',y='Kilometers_Driven',data=Train)
Out[68]:
<seaborn.axisgrid.JointGrid at 0x1fb62100748>
In [69]:
print("Minimum year in the data is:",Train.Year.min())
print("Maximum year in the data is:",Train.Year.max())
print("Range of year is from {} to {},value is{}".format(Train.Year.max(),Train.Year.min(),Train.Year.max()-Train.Year.min()))
print("Default bin is 50,so each bar corresponds to the value of:",(Train.Year.max()-Train.Year.min())/50)
Minimum year in the data is: 1998
Maximum year in the data is: 2019
Range of year is from 2019 to 1998,value is21
Default bin is 50,so each bar corresponds to the value of: 0.42
In [70]:
plt.figure(figsize=(20,10))
sns.barplot(x="Engine",y="Price",data=Train)
Out[70]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb61d4f108>
In [71]:
plt.figure(figsize=(20,10))
sns.scatterplot(x='Kilometers_Driven',y='Price',data=Train, hue='Brand')
plt.xlim(0, 350000)
Out[71]:
(0, 350000)
In [72]:
 plt.figure(figsize=(20,10))
sns.scatterplot(x='Kilometers_Driven',y='Price',data=Train, hue='Fuel_Type')
plt.xlim(0, 350000)
Out[72]:
(0, 350000)
In [73]:
plt.figure(figsize=(20,10))
sns.scatterplot(x='Kilometers_Driven',y='Price',data=Train, hue='Location')
plt.xlim(0, 350000)
Out[73]:
(0, 350000)
In [74]:
plt.figure(figsize=(10,30))
sns.boxplot(
    data=Train,
    x='Price',y='Brand')
Out[74]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb67212088>
In [75]:
plt.figure(figsize=(10,5))
sns.boxplot(
    data=Train,
    x='Kilometers_Driven')
Out[75]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb67a3af88>
In [76]:
plt.figure(figsize=(10,10))
sns.boxplot(
    data=Train,
    x='Price')
Out[76]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb67a70548>
In [77]:
plt.figure(figsize=(10,10))
sns.boxplot(
    data=Train,
    x='Kilometers_Driven')
Out[77]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb67ad94c8>
In [78]:
pd.crosstab(Train.Name,Train.Location)
Out[78]:
Location Ahmedabad Bangalore Chennai Coimbatore Delhi Hyderabad Jaipur Kochi Kolkata Mumbai Pune
Name
Ambassador Classic Nova Diesel 0 0 1 0 0 0 0 0 0 0 0
Audi A3 35 TDI Attraction 0 0 1 0 0 0 0 0 0 0 0
Audi A3 35 TDI Premium 0 0 0 0 0 0 0 0 0 1 0
Audi A3 35 TDI Premium Plus 0 0 0 0 0 0 0 0 0 1 0
Audi A3 35 TDI Technology 0 0 0 0 1 0 0 0 0 0 0
... ... ... ... ... ... ... ... ... ... ... ...
Volvo XC60 D4 Summum 0 0 0 0 0 1 0 0 0 0 0
Volvo XC60 D5 1 0 0 0 0 1 0 0 0 0 1
Volvo XC60 D5 Inscription 0 0 0 0 0 0 0 1 0 0 0
Volvo XC90 2007-2015 D5 AT AWD 0 0 0 0 0 0 0 1 0 0 0
Volvo XC90 2007-2015 D5 AWD 0 0 0 0 0 0 0 1 0 0 0

1873 rows × 11 columns

In [79]:
pd.crosstab(Train.Name,Train.Fuel_Type)
Out[79]:
Fuel_Type CNG Diesel Electric LPG Petrol
Name
Ambassador Classic Nova Diesel 0 1 0 0 0
Audi A3 35 TDI Attraction 0 1 0 0 0
Audi A3 35 TDI Premium 0 1 0 0 0
Audi A3 35 TDI Premium Plus 0 1 0 0 0
Audi A3 35 TDI Technology 0 1 0 0 0
... ... ... ... ... ...
Volvo XC60 D4 Summum 0 1 0 0 0
Volvo XC60 D5 0 3 0 0 0
Volvo XC60 D5 Inscription 0 1 0 0 0
Volvo XC90 2007-2015 D5 AT AWD 0 1 0 0 0
Volvo XC90 2007-2015 D5 AWD 0 1 0 0 0

1873 rows × 5 columns

In [80]:
pd.crosstab(Train.Name, Train.Owner_Type)
Out[80]:
Owner_Type First Fourth & Above Second Third
Name
Ambassador Classic Nova Diesel 0 0 0 1
Audi A3 35 TDI Attraction 1 0 0 0
Audi A3 35 TDI Premium 1 0 0 0
Audi A3 35 TDI Premium Plus 1 0 0 0
Audi A3 35 TDI Technology 0 0 1 0
... ... ... ... ...
Volvo XC60 D4 Summum 0 0 1 0
Volvo XC60 D5 3 0 0 0
Volvo XC60 D5 Inscription 1 0 0 0
Volvo XC90 2007-2015 D5 AT AWD 1 0 0 0
Volvo XC90 2007-2015 D5 AWD 1 0 0 0

1873 rows × 4 columns

Scaling Data

In [81]:
Train.Kilometers_Driven=(Train.Kilometers_Driven-Train.Kilometers_Driven.min())/(Train.Kilometers_Driven.max()-Train.Kilometers_Driven.min())
Train.Kilometers_Driven
Out[81]:
0       0.092703
1       0.052694
2       0.059147
3       0.112062
4       0.052268
          ...   
6014    0.035097
6015    0.128840
6016    0.070763
6017    0.059147
6018    0.060438
Name: Kilometers_Driven, Length: 6015, dtype: float64
In [82]:
Test.Kilometers_Driven=(Test.Kilometers_Driven-Test.Kilometers_Driven.min())/(Test.Kilometers_Driven.max()-Test.Kilometers_Driven.min())
Test.Kilometers_Driven
Out[82]:
0       0.114410
1       0.153275
2       0.094556
3       0.395415
4       0.080229
          ...   
1229    0.253327
1230    0.166189
1231    0.077364
1232    0.146883
1233    0.204708
Name: Kilometers_Driven, Length: 1234, dtype: float64
In [83]:
scaler = MinMaxScaler()
num_vars = ['Mileage', 'Power', 'Engine','Mileage_per_kg','Mileage_per_l']
Train[num_vars] = scaler.fit_transform(Train[num_vars])
Train
Out[83]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
0 Maruti Wagon R LXI CNG Mumbai 2010 0.092703 CNG Manual First 0.793083 0.156261 0.105362 5.0 1.75 0.793083 0.000000 Maruti Wagon R LXI CNG 10
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 0.052694 Diesel Manual First 0.586464 0.254809 0.228623 5.0 12.50 0.000000 0.692606 Hyundai Creta 1.6 CRDi SX Option 5
2 Honda Jazz V Chennai 2011 0.059147 Petrol Manual First 0.542636 0.190179 0.160688 5.0 4.50 0.000000 0.640845 Honda Jazz V 9
3 Maruti Ertiga VDI Chennai 2012 0.112062 Diesel Manual First 0.619261 0.198448 0.160797 7.0 6.00 0.000000 0.731338 Maruti Ertiga VDI 8
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 0.052268 Diesel Automatic Second 0.453190 0.319946 0.255072 5.0 17.74 0.000000 0.535211 Audi A4 New 2.0 TDI Multitronic 7
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 0.035097 Diesel Manual First 0.846750 0.198448 0.134058 5.0 4.75 0.000000 1.000000 Maruti Swift VDI 6
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 0.128840 Diesel Manual First 0.727490 0.176848 0.128623 5.0 4.00 0.000000 0.859155 Hyundai Xcent 1.1 CRDi S 5
6016 Mahindra Xylo D4 BSIV Jaipur 2012 0.070763 Diesel Manual Second 0.417412 0.409382 0.202899 8.0 2.90 0.000000 0.492958 Mahindra Xylo D4 BSIV 8
6017 Maruti Wagon R VXI Kolkata 2013 0.059147 Petrol Manual First 0.563506 0.156261 0.121558 5.0 2.65 0.000000 0.665493 Maruti Wagon R VXI 7
6018 Chevrolet Beat Diesel Hyderabad 2011 0.060438 Diesel Manual First 0.758497 0.145798 0.104348 5.0 2.50 0.000000 0.895775 Chevrolet Beat Diesel 9

6015 rows × 18 columns

In [84]:
scaler = MinMaxScaler()
num_vars = ['Mileage', 'Power', 'Engine','Mileage_per_kg','Mileage_per_l']
Test[num_vars] = scaler.fit_transform(Test[num_vars])
Test
Out[84]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Mileage_per_kg Mileage_per_l Brand Model Version Age
0 Maruti Alto K10 LXI CNG Delhi 2014 0.114410 CNG Manual First 1.000000 0.069594 0.094481 4.0 1.0 0.000000 Maruti Alto K10 LXI CNG 6
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 0.153275 Petrol Manual Second 0.765654 0.032006 0.076786 5.0 0.0 0.869718 Maruti Alto 800 2016-2019 LXI 7
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 0.094556 Diesel Manual First 0.424055 0.329178 0.239935 7.0 0.0 0.481690 Toyota Innova Crysta Touring Sport 2.4 MT 3
3 Toyota Etios Liva GD Hyderabad 2012 0.395415 Diesel Manual First 0.731246 0.137700 0.000000 5.0 0.0 0.830634 Toyota Etios Liva GD 8
4 Hyundai i20 Magna Mumbai 2014 0.080229 Petrol Manual First 0.573466 0.106624 0.134497 5.0 0.0 0.651408 Hyundai i20 Magna 6
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 0.253327 Diesel Manual First 0.636702 0.181243 0.168182 5.0 0.0 0.723239 Volkswagen Vento Diesel Trendline 9
1230 Volkswagen Polo GT TSI Mumbai 2015 0.166189 Petrol Automatic First 0.533478 0.106624 0.168182 5.0 0.0 0.605986 Volkswagen Polo GT TSI 5
1231 Nissan Micra Diesel XV Kolkata 2012 0.077364 Diesel Manual First 0.715437 0.155750 0.102435 5.0 0.0 0.812676 Nissan Micra Diesel XV 8
1232 Volkswagen Polo GT TSI Pune 2013 0.146883 Petrol Automatic Third 0.533168 0.106624 0.168182 5.0 0.0 0.605634 Volkswagen Polo GT TSI 7
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 0.204708 Diesel Automatic First 0.309981 0.283588 0.275974 5.0 0.0 0.352113 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avantgarde 6

1234 rows × 17 columns

In [85]:
corrmat = Train.corr()
f, ax = plt.subplots(figsize=(7, 7))
sns.heatmap(corrmat, vmax=.8, square=True);
In [86]:
corr = Train.corr()
sns.heatmap(corr, xticklabels=corr.columns, yticklabels=corr.columns, annot=True, cmap=sns.diverging_palette(220, 20, as_cmap=True))
Out[86]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb67ea2d88>
In [87]:
sns.lmplot(x='Year', y='Price', data=Train)
Out[87]:
<seaborn.axisgrid.FacetGrid at 0x1fb67fc0d08>
In [88]:
plt.figure(figsize = (10, 6))
sns.boxplot(data=Train)
Out[88]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb685e81c8>
In [89]:
Train.boxplot(column=["Age","Seats"])
Out[89]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb6885f348>
In [90]:
Test.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1234 entries, 0 to 1233
Data columns (total 17 columns):
 #   Column             Non-Null Count  Dtype  
---  ------             --------------  -----  
 0   Name               1234 non-null   object 
 1   Location           1234 non-null   object 
 2   Year               1234 non-null   int64  
 3   Kilometers_Driven  1234 non-null   float64
 4   Fuel_Type          1234 non-null   object 
 5   Transmission       1234 non-null   object 
 6   Owner_Type         1234 non-null   object 
 7   Mileage            1234 non-null   float64
 8   Engine             1234 non-null   float64
 9   Power              1234 non-null   float64
 10  Seats              1234 non-null   float64
 11  Mileage_per_kg     1234 non-null   float64
 12  Mileage_per_l      1234 non-null   float64
 13  Brand              1234 non-null   object 
 14  Model              1234 non-null   object 
 15  Version            1234 non-null   object 
 16  Age                1234 non-null   int64  
dtypes: float64(7), int64(2), object(8)
memory usage: 164.0+ KB
In [91]:
sns.boxplot(x=Train['Age'],)
Out[91]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb671bd688>
In [92]:
Train[Train['Seats'].isnull()]
Out[92]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
In [93]:
x = Train['Price']
plt.figure(figsize=(10,6))
sns.distplot(x).set_title('Frequency Distribution Plot of Prices')
Out[93]:
Text(0.5, 1.0, 'Frequency Distribution Plot of Prices')
In [94]:
print(Train['Price'].mean())
print(Train['Price'].median())
print(Train['Price'].mode())
9.425423108894414
5.63
0    4.5
dtype: float64

Reggression

In [95]:
plt.figure(figsize=(20,8))
sns.regplot(x='Age', y='Price',data=Train).set_title('Age vs Price')
Out[95]:
Text(0.5, 1.0, 'Age vs Price')
In [96]:
Train = Train[Train.Kilometers_Driven < 400000]
plt.figure(figsize=(10,6))
sns.regplot(x='Kilometers_Driven', y='Price', data=Train).set_title('Km vs Price')
Out[96]:
Text(0.5, 1.0, 'Km vs Price')
In [97]:
plt.figure(figsize=(20,15))
sns.boxplot(data=Train, x='Location',y='Price')
Out[97]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb65af76c8>
In [98]:
plt.figure(figsize=(20,10))
sns.boxplot(data=Train,x='Fuel_Type',y='Price')
Out[98]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb672c5988>
In [99]:
plt.figure(figsize=(20,5))
plt.subplot(1,5,1)
x=Train['Location'].value_counts().index
y=Train['Location'].value_counts().values
plt.pie(y,labels=x,autopct='%1.1f%%')
plt.title("Location distribution")
plt.subplot(1,5,2)
x=Train['Owner_Type'].value_counts().index
y=Train['Owner_Type'].value_counts().values
plt.pie(y,labels=x,autopct='%1.1f%%')
plt.title("Owner Type distribution")
plt.subplot(1,5,3)
x=Train['Fuel_Type'].value_counts().index
y=Train['Fuel_Type'].value_counts().values
plt.pie(y,labels=x,autopct='%1.1f%%')
plt.title("Fuel_Type distribution")
plt.subplot(1,5,4)
x=Train['Transmission'].value_counts().index
y=Train['Transmission'].value_counts().values
plt.pie(y,labels=x,autopct='%1.1f%%')
plt.title("Transmission distribution")
plt.subplot(1,5,5)
x=Train['Seats'].value_counts().index
y=Train['Seats'].value_counts().values
plt.pie(y,labels=x,autopct='%1.1f%%')
plt.title("Seats distribution")
Out[99]:
Text(0.5, 1.0, 'Seats distribution')
In [100]:
sns.pairplot(Train)
Out[100]:
<seaborn.axisgrid.PairGrid at 0x1fb674002c8>
In [101]:
sns.set(font_scale = 1)
sns.relplot(x = "Year" , y = "Price" , data = Train , hue = "Fuel_Type" ,kind ="line", col = "Owner_Type")
Out[101]:
<seaborn.axisgrid.FacetGrid at 0x1fb6bfa6dc8>
In [102]:
sns.relplot(x = "Year" , y = "Price" , data = Train , hue = "Fuel_Type" , 
            size = "Transmission", sizes=(20,200))
Out[102]:
<seaborn.axisgrid.FacetGrid at 0x1fb6fa2d988>
In [103]:
sns.relplot(x = "Year" , y = "Price" , data = Train , hue = "Owner_Type", kind = "line" )
Out[103]:
<seaborn.axisgrid.FacetGrid at 0x1fb6f9ebe48>

Encoding the categorical variables

In [104]:
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
New_train=Train.copy()
New_test=Test.copy()
New_train= pd.concat([New_train,pd.get_dummies(New_train['Location'], prefix='Location').astype(float)],axis=1)
New_test= pd.concat([New_test,pd.get_dummies(New_test['Location'], prefix='Location').astype(float)],axis=1)
Train
Out[104]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
0 Maruti Wagon R LXI CNG Mumbai 2010 0.092703 CNG Manual First 0.793083 0.156261 0.105362 5.0 1.75 0.793083 0.000000 Maruti Wagon R LXI CNG 10
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 0.052694 Diesel Manual First 0.586464 0.254809 0.228623 5.0 12.50 0.000000 0.692606 Hyundai Creta 1.6 CRDi SX Option 5
2 Honda Jazz V Chennai 2011 0.059147 Petrol Manual First 0.542636 0.190179 0.160688 5.0 4.50 0.000000 0.640845 Honda Jazz V 9
3 Maruti Ertiga VDI Chennai 2012 0.112062 Diesel Manual First 0.619261 0.198448 0.160797 7.0 6.00 0.000000 0.731338 Maruti Ertiga VDI 8
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 0.052268 Diesel Automatic Second 0.453190 0.319946 0.255072 5.0 17.74 0.000000 0.535211 Audi A4 New 2.0 TDI Multitronic 7
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 0.035097 Diesel Manual First 0.846750 0.198448 0.134058 5.0 4.75 0.000000 1.000000 Maruti Swift VDI 6
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 0.128840 Diesel Manual First 0.727490 0.176848 0.128623 5.0 4.00 0.000000 0.859155 Hyundai Xcent 1.1 CRDi S 5
6016 Mahindra Xylo D4 BSIV Jaipur 2012 0.070763 Diesel Manual Second 0.417412 0.409382 0.202899 8.0 2.90 0.000000 0.492958 Mahindra Xylo D4 BSIV 8
6017 Maruti Wagon R VXI Kolkata 2013 0.059147 Petrol Manual First 0.563506 0.156261 0.121558 5.0 2.65 0.000000 0.665493 Maruti Wagon R VXI 7
6018 Chevrolet Beat Diesel Hyderabad 2011 0.060438 Diesel Manual First 0.758497 0.145798 0.104348 5.0 2.50 0.000000 0.895775 Chevrolet Beat Diesel 9

6015 rows × 18 columns

In [105]:
New_train= pd.concat([New_train,pd.get_dummies(New_train['Brand'], prefix='Br').astype(float)],axis=1)
New_test= pd.concat([New_test,pd.get_dummies(New_test['Brand'], prefix='Br').astype(float)],axis=1)
Train
Out[105]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg Mileage_per_l Brand Model Version Age
0 Maruti Wagon R LXI CNG Mumbai 2010 0.092703 CNG Manual First 0.793083 0.156261 0.105362 5.0 1.75 0.793083 0.000000 Maruti Wagon R LXI CNG 10
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 0.052694 Diesel Manual First 0.586464 0.254809 0.228623 5.0 12.50 0.000000 0.692606 Hyundai Creta 1.6 CRDi SX Option 5
2 Honda Jazz V Chennai 2011 0.059147 Petrol Manual First 0.542636 0.190179 0.160688 5.0 4.50 0.000000 0.640845 Honda Jazz V 9
3 Maruti Ertiga VDI Chennai 2012 0.112062 Diesel Manual First 0.619261 0.198448 0.160797 7.0 6.00 0.000000 0.731338 Maruti Ertiga VDI 8
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 0.052268 Diesel Automatic Second 0.453190 0.319946 0.255072 5.0 17.74 0.000000 0.535211 Audi A4 New 2.0 TDI Multitronic 7
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 0.035097 Diesel Manual First 0.846750 0.198448 0.134058 5.0 4.75 0.000000 1.000000 Maruti Swift VDI 6
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 0.128840 Diesel Manual First 0.727490 0.176848 0.128623 5.0 4.00 0.000000 0.859155 Hyundai Xcent 1.1 CRDi S 5
6016 Mahindra Xylo D4 BSIV Jaipur 2012 0.070763 Diesel Manual Second 0.417412 0.409382 0.202899 8.0 2.90 0.000000 0.492958 Mahindra Xylo D4 BSIV 8
6017 Maruti Wagon R VXI Kolkata 2013 0.059147 Petrol Manual First 0.563506 0.156261 0.121558 5.0 2.65 0.000000 0.665493 Maruti Wagon R VXI 7
6018 Chevrolet Beat Diesel Hyderabad 2011 0.060438 Diesel Manual First 0.758497 0.145798 0.104348 5.0 2.50 0.000000 0.895775 Chevrolet Beat Diesel 9

6015 rows × 18 columns

In [106]:
lben = LabelEncoder()

New_train['Fuel_Type'] = lben.fit_transform(New_train['Fuel_Type']).astype(float)
New_train['Owner_Type'] = lben.fit_transform(New_train['Owner_Type']).astype(float)
New_train['Transmission'] = lben.fit_transform(New_train['Transmission']).astype(float)
In [107]:
lben = LabelEncoder()

New_test['Fuel_Type'] = lben.fit_transform(New_test['Fuel_Type']).astype(float)
New_test['Owner_Type'] = lben.fit_transform(New_test['Owner_Type']).astype(float)
New_test['Transmission'] = lben.fit_transform(New_test['Transmission']).astype(float)
New_test
Out[107]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power ... Br_Mitsubishi Br_Nissan Br_OpelCorsa Br_Porsche Br_Renault Br_Skoda Br_Tata Br_Toyota Br_Volkswagen Br_Volvo
0 Maruti Alto K10 LXI CNG Delhi 2014 0.114410 0.0 1.0 0.0 1.000000 0.069594 0.094481 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 0.153275 3.0 1.0 2.0 0.765654 0.032006 0.076786 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 0.094556 1.0 1.0 0.0 0.424055 0.329178 0.239935 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0
3 Toyota Etios Liva GD Hyderabad 2012 0.395415 1.0 1.0 0.0 0.731246 0.137700 0.000000 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0
4 Hyundai i20 Magna Mumbai 2014 0.080229 3.0 1.0 0.0 0.573466 0.106624 0.134497 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 Volkswagen Vento Diesel Trendline Hyderabad 2011 0.253327 1.0 1.0 0.0 0.636702 0.181243 0.168182 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0
1230 Volkswagen Polo GT TSI Mumbai 2015 0.166189 3.0 0.0 0.0 0.533478 0.106624 0.168182 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0
1231 Nissan Micra Diesel XV Kolkata 2012 0.077364 1.0 1.0 0.0 0.715437 0.155750 0.102435 ... 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1232 Volkswagen Polo GT TSI Pune 2013 0.146883 3.0 0.0 3.0 0.533168 0.106624 0.168182 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0
1233 Mercedes-Benz E-Class 2009-2013 E 220 CDI Avan... Kochi 2014 0.204708 1.0 0.0 0.0 0.309981 0.283588 0.275974 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

1234 rows × 57 columns

In [108]:
New_train
Out[108]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power ... Br_Mitsubishi Br_Nissan Br_Porsche Br_Renault Br_Skoda Br_Smart Br_Tata Br_Toyota Br_Volkswagen Br_Volvo
0 Maruti Wagon R LXI CNG Mumbai 2010 0.092703 0.0 1.0 0.0 0.793083 0.156261 0.105362 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 Hyundai Creta 1.6 CRDi SX Option Pune 2015 0.052694 1.0 1.0 0.0 0.586464 0.254809 0.228623 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 Honda Jazz V Chennai 2011 0.059147 4.0 1.0 0.0 0.542636 0.190179 0.160688 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3 Maruti Ertiga VDI Chennai 2012 0.112062 1.0 1.0 0.0 0.619261 0.198448 0.160797 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 Audi A4 New 2.0 TDI Multitronic Coimbatore 2013 0.052268 1.0 0.0 2.0 0.453190 0.319946 0.255072 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
6014 Maruti Swift VDI Delhi 2014 0.035097 1.0 1.0 0.0 0.846750 0.198448 0.134058 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
6015 Hyundai Xcent 1.1 CRDi S Jaipur 2015 0.128840 1.0 1.0 0.0 0.727490 0.176848 0.128623 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
6016 Mahindra Xylo D4 BSIV Jaipur 2012 0.070763 1.0 1.0 2.0 0.417412 0.409382 0.202899 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
6017 Maruti Wagon R VXI Kolkata 2013 0.059147 4.0 1.0 0.0 0.563506 0.156261 0.121558 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
6018 Chevrolet Beat Diesel Hyderabad 2011 0.060438 1.0 1.0 0.0 0.758497 0.145798 0.104348 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

6015 rows × 59 columns

In [109]:
New_train=New_train.drop(['Year'],axis=1)
New_test=New_test.drop(['Year'],axis=1)
In [110]:
New_train.corr()
Out[110]:
Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Price Mileage_per_kg ... Br_Mitsubishi Br_Nissan Br_Porsche Br_Renault Br_Skoda Br_Smart Br_Tata Br_Toyota Br_Volkswagen Br_Volvo
Kilometers_Driven 1.000000 -0.222873 0.106544 0.206771 -0.144290 0.154983 -0.015089 0.211302 -0.168420 -0.003694 ... 0.043587 0.025328 -0.025498 -0.019847 0.049254 0.015436 0.045489 0.185742 -0.002942 0.020115
Fuel_Type -0.222873 1.000000 0.125461 0.042436 -0.151753 -0.405937 -0.267428 -0.299075 -0.312453 -0.135931 ... -0.036027 -0.017220 -0.007145 -0.036465 0.000802 -0.011679 -0.034785 -0.116545 0.005792 -0.053609
Transmission 0.106544 0.125461 1.000000 0.003484 0.332282 -0.498084 -0.633700 0.072287 -0.594064 0.064509 ... 0.009378 0.042110 -0.079975 0.056090 -0.096145 -0.020410 0.089463 0.026635 0.051012 -0.087444
Owner_Type 0.206771 0.042436 0.003484 1.000000 -0.153305 0.043858 -0.000532 0.003847 -0.101011 -0.001102 ... 0.026639 -0.004178 0.015533 -0.025161 -0.010465 0.025552 0.031075 0.008975 -0.016838 0.007018
Mileage -0.144290 -0.151753 0.332282 -0.153305 1.000000 -0.580429 -0.438197 -0.305013 -0.307590 0.176618 ... -0.088403 0.033100 -0.055321 0.088074 -0.051021 -0.051085 0.066354 -0.221932 0.006157 -0.034201
Engine 0.154983 -0.405937 -0.498084 0.043858 -0.580429 1.000000 0.841769 0.404794 0.659765 -0.096854 ... 0.103290 -0.032318 0.170627 -0.080717 0.048629 -0.017650 -0.080192 0.313136 -0.068904 0.053733
Power -0.015089 -0.267428 -0.633700 -0.000532 -0.438197 0.841769 1.000000 0.115229 0.761270 -0.091905 ... 0.035694 -0.055148 0.182873 -0.067372 0.047262 -0.026002 -0.105848 0.064910 -0.070654 0.082312
Seats 0.211302 -0.299075 0.072287 0.003847 -0.305013 0.404794 0.115229 1.000000 0.063295 -0.039158 ... 0.066582 -0.039586 -0.083471 -0.046399 -0.059675 -0.052674 -0.022455 0.411845 -0.084311 -0.006478
Price -0.168420 -0.312453 -0.594064 -0.101011 -0.307590 0.659765 0.761270 0.063295 1.000000 -0.057326 ... 0.010059 -0.053273 0.195556 -0.052268 -0.029453 -0.007598 -0.096038 0.053510 -0.088780 0.050902
Mileage_per_kg -0.003694 -0.135931 0.064509 -0.001102 0.176618 -0.096854 -0.091905 -0.039158 -0.057326 1.000000 ... -0.006856 -0.012655 -0.005594 -0.016048 -0.017571 -0.001317 -0.000295 -0.024016 -0.024003 -0.006044
Mileage_per_l -0.133253 -0.068854 0.279193 -0.142915 0.844459 -0.491716 -0.360934 -0.265031 -0.258404 -0.374323 ... -0.079281 0.038084 -0.048894 0.091610 -0.038245 -0.047274 0.062714 -0.197537 0.019029 -0.028801
Age 0.448684 0.129062 0.096878 0.386088 -0.321757 0.046456 -0.075922 -0.014468 -0.311195 -0.008432 ... 0.046136 0.006474 0.002268 -0.071985 0.053198 0.021129 -0.004255 0.029014 -0.011037 0.001301
Location_Ahmedabad -0.012678 -0.034597 0.011480 -0.009602 0.029430 -0.011176 -0.009108 -0.001466 -0.017461 0.004225 ... -0.013207 -0.009990 -0.010775 -0.008013 -0.002325 -0.002536 0.010516 0.009376 -0.010762 0.018130
Location_Bangalore 0.005181 -0.033121 -0.065153 0.111033 -0.077701 0.080333 0.085635 0.015206 0.090046 -0.025686 ... 0.025155 -0.025422 -0.000918 0.020020 -0.005451 -0.003244 -0.012463 -0.012426 -0.008669 0.008936
Location_Chennai 0.152299 -0.026954 0.029054 0.122298 -0.007847 0.000457 -0.035554 0.013439 -0.048991 -0.019093 ... 0.025269 0.027514 -0.016370 -0.023252 -0.029661 -0.003853 0.020149 0.019971 0.033143 0.002865
Location_Coimbatore -0.096696 -0.009636 -0.078494 -0.073493 -0.024999 0.057311 0.084112 0.010104 0.178253 -0.035109 ... -0.006914 -0.020472 0.010856 -0.004694 -0.020354 -0.004434 0.007287 -0.009551 -0.015306 -0.011187
Location_Delhi -0.002204 -0.020150 -0.015592 -0.011050 -0.014867 0.042877 0.041230 0.038069 0.002418 0.025830 ... 0.004456 -0.025295 0.003636 -0.004993 0.007212 -0.004103 -0.033572 0.066622 -0.028309 -0.009079
Location_Hyderabad 0.128759 -0.108158 0.019181 -0.069692 0.029561 0.006569 -0.035469 0.020216 0.004706 -0.002813 ... -0.002436 0.011629 -0.001987 -0.006068 0.026397 -0.004830 0.017886 0.012912 0.002833 0.029317
Location_Jaipur 0.100192 -0.006941 0.095836 0.067022 0.050857 -0.074986 -0.094177 -0.012238 -0.090043 -0.016389 ... -0.008398 0.009435 -0.014876 0.034480 -0.011323 -0.003501 0.035050 -0.029235 -0.010708 -0.016071
Location_Kochi -0.117987 0.043291 -0.022847 -0.111141 0.038236 -0.021630 0.019971 -0.029457 0.056029 0.003344 ... -0.007382 -0.008106 0.020102 0.015026 -0.015124 -0.004492 -0.031317 -0.030716 -0.021841 0.015670
Location_Kolkata -0.116322 0.041851 0.093936 -0.099167 0.068627 -0.074692 -0.063966 -0.044313 -0.107859 -0.031903 ... -0.012244 0.013904 0.004266 -0.026262 -0.015331 -0.004029 -0.011955 -0.029064 0.028792 -0.018494
Location_Mumbai -0.128127 0.092659 -0.084612 -0.008174 -0.066555 0.032178 0.061461 -0.003594 0.000139 0.041439 ... -0.004021 0.016324 0.014741 -0.000141 0.050884 -0.005014 -0.038183 -0.001912 0.021274 -0.014671
Location_Pune 0.115552 0.036741 0.040444 0.128920 -0.014971 -0.043054 -0.065192 -0.005514 -0.084063 0.042566 ... 0.001699 0.002638 -0.018606 0.007140 0.000361 0.037970 0.046573 0.003244 0.003496 -0.001588
Br_Ambassador 0.007604 -0.011679 0.008147 0.041318 -0.015036 -0.002770 -0.017679 -0.004472 -0.009549 -0.001317 ... -0.000866 -0.001598 -0.000706 -0.002027 -0.002219 -0.000166 -0.002303 -0.003492 -0.003031 -0.000763
Br_Audi -0.025514 -0.151835 -0.319150 0.007221 -0.129795 0.222713 0.297726 0.001709 0.298529 -0.020588 ... -0.013540 -0.024991 -0.011047 -0.031691 -0.034699 -0.002600 -0.036019 -0.054606 -0.047401 -0.011935
Br_BMW -0.013171 -0.149681 -0.340463 0.029787 -0.053811 0.245381 0.376196 -0.086684 0.309073 -0.021963 ... -0.014444 -0.026660 -0.011785 -0.033807 -0.037016 -0.002774 -0.038424 -0.058253 -0.050566 -0.012732
Br_Bentley -0.003293 0.014028 -0.020410 -0.005979 -0.026865 0.094469 0.103423 -0.020539 0.058624 -0.001317 ... -0.000866 -0.001598 -0.000706 -0.002027 -0.002219 -0.000166 -0.002303 -0.003492 -0.003031 -0.000763
Br_Chevrolet 0.020314 0.023675 0.066922 0.036359 0.008205 -0.060756 -0.054826 -0.000996 -0.083844 -0.014630 ... -0.009621 -0.017758 -0.007850 -0.022519 -0.024656 -0.001848 -0.025595 -0.038802 -0.033683 -0.008481
Br_Datsun -0.047233 0.050630 0.029403 -0.021578 0.035086 -0.049367 -0.043313 0.010626 -0.027213 -0.004752 ... -0.003125 -0.005768 -0.002550 -0.007315 -0.008009 -0.000600 -0.008313 -0.012604 -0.010941 -0.002755
Br_Fiat 0.021900 0.001360 0.043207 0.019057 -0.011411 -0.040916 -0.039020 -0.023715 -0.038608 -0.006983 ... -0.004592 -0.008476 -0.003747 -0.010748 -0.011768 -0.000882 -0.012216 -0.018520 -0.016077 -0.004048
Br_Force -0.008065 -0.020232 0.014113 -0.010357 -0.005557 0.021129 0.011426 0.047922 -0.000189 -0.002281 ... -0.001500 -0.002769 -0.001224 -0.003511 -0.003844 -0.000288 -0.003990 -0.006050 -0.005251 -0.001322
Br_Ford 0.034173 -0.064392 0.078792 0.026363 0.016473 -0.007595 -0.065644 -0.008080 -0.053285 -0.023394 ... -0.015385 -0.028397 -0.012552 -0.036010 -0.039427 -0.002954 -0.040927 -0.062048 -0.053860 -0.013561
Br_Honda -0.023991 0.226263 0.053076 0.000293 0.018913 -0.066166 -0.017552 -0.083298 -0.123428 -0.034239 ... -0.022517 -0.041561 -0.018371 -0.052703 -0.057705 -0.004324 -0.059901 -0.090812 -0.078830 -0.019848
Br_Hyundai -0.078727 0.206193 0.159438 -0.006187 0.061213 -0.247630 -0.192442 -0.144378 -0.177783 -0.022286 ... -0.031891 -0.058862 -0.026019 -0.074643 -0.081727 -0.006124 -0.084836 -0.128616 -0.111645 -0.028111
Br_ISUZU -0.016837 -0.016518 0.011522 -0.008456 -0.022859 0.026889 0.007660 -0.006324 0.004381 -0.001862 ... -0.001225 -0.002260 -0.000999 -0.002866 -0.003138 -0.000235 -0.003258 -0.004939 -0.004287 -0.001079
Br_Isuzu -0.007915 -0.011679 -0.020410 -0.005979 -0.012220 0.029794 0.014928 0.027663 0.012505 -0.001317 ... -0.000866 -0.001598 -0.000706 -0.002027 -0.002219 -0.000166 -0.002303 -0.003492 -0.003031 -0.000763
Br_Jaguar -0.046002 -0.057794 -0.129505 -0.017928 -0.056884 0.137620 0.190689 -0.043666 0.211647 -0.008354 ... -0.005494 -0.010141 -0.004483 -0.012860 -0.014080 -0.001055 -0.014616 -0.022158 -0.019234 -0.004843
Br_Jeep -0.039442 -0.038640 0.024208 -0.023182 -0.015059 0.025034 0.053124 -0.017339 0.042612 -0.005105 ... -0.003357 -0.006197 -0.002739 -0.007858 -0.008604 -0.000645 -0.008932 -0.013541 -0.011754 -0.002960
Br_Land 0.007331 -0.086781 -0.153798 0.028103 -0.156945 0.130583 0.129784 0.013831 0.253627 -0.010162 ... -0.006683 -0.012336 -0.005453 -0.015643 -0.017127 -0.001283 -0.017779 -0.026954 -0.023397 -0.005891
Br_Mahindra 0.066101 -0.180626 0.087883 0.003769 -0.146427 0.185275 0.035801 0.475850 -0.027532 -0.022221 ... -0.014614 -0.026973 -0.011923 -0.034204 -0.037450 -0.002806 -0.038875 -0.058937 -0.051160 -0.012881
Br_Maruti -0.053645 0.107312 0.226311 -0.044218 0.369181 -0.392339 -0.348641 -0.083187 -0.225988 0.168006 ... -0.033714 -0.062228 -0.027507 -0.078911 -0.086400 -0.006474 -0.089687 -0.135970 -0.118029 -0.029718
Br_Mercedes-Benz -0.055554 -0.096972 -0.344336 -0.005079 -0.219157 0.298251 0.349950 -0.068969 0.376658 -0.024123 ... -0.015865 -0.029282 -0.012944 -0.037133 -0.040657 -0.003047 -0.042204 -0.063983 -0.055540 -0.013984
Br_Mini -0.057038 0.006002 -0.098676 0.006631 0.006546 0.016440 0.043774 -0.070214 0.105569 -0.006728 ... -0.004424 -0.008166 -0.003610 -0.010356 -0.011338 -0.000850 -0.011770 -0.017844 -0.015489 -0.003900
Br_Mitsubishi 0.043587 -0.036027 0.009378 0.026639 -0.088403 0.103290 0.035694 0.066582 0.010059 -0.006856 ... 1.000000 -0.008323 -0.003679 -0.010554 -0.011555 -0.000866 -0.011995 -0.018185 -0.015786 -0.003975
Br_Nissan 0.025328 -0.017220 0.042110 -0.004178 0.033100 -0.032318 -0.055148 -0.039586 -0.053273 -0.012655 ... -0.008323 1.000000 -0.006790 -0.019480 -0.021328 -0.001598 -0.022140 -0.033565 -0.029136 -0.007336
Br_Porsche -0.025498 -0.007145 -0.079975 0.015533 -0.055321 0.170627 0.182873 -0.083471 0.195556 -0.005594 ... -0.003679 -0.006790 1.000000 -0.008611 -0.009428 -0.000706 -0.009787 -0.014837 -0.012879 -0.003243
Br_Renault -0.019847 -0.036465 0.056090 -0.025161 0.088074 -0.080717 -0.067372 -0.046399 -0.052268 -0.016048 ... -0.010554 -0.019480 -0.008611 1.000000 -0.027046 -0.002027 -0.028075 -0.042563 -0.036947 -0.009303
Br_Skoda 0.049254 0.000802 -0.096145 -0.010465 -0.051021 0.048629 0.047262 -0.059675 -0.029453 -0.017571 ... -0.011555 -0.021328 -0.009428 -0.027046 1.000000 -0.002219 -0.030740 -0.046603 -0.040454 -0.010186
Br_Smart 0.015436 -0.011679 -0.020410 0.025552 -0.051085 -0.017650 -0.026002 -0.052674 -0.007598 -0.001317 ... -0.000866 -0.001598 -0.000706 -0.002027 -0.002219 1.000000 -0.002303 -0.003492 -0.003031 -0.000763
Br_Tata 0.045489 -0.034785 0.089463 0.031075 0.066354 -0.080192 -0.105848 -0.022455 -0.096038 -0.000295 ... -0.011995 -0.022140 -0.009787 -0.028075 -0.030740 -0.002303 1.000000 -0.048376 -0.041993 -0.010573
Br_Toyota 0.185742 -0.116545 0.026635 0.008975 -0.221932 0.313136 0.064910 0.411845 0.053510 -0.024016 ... -0.018185 -0.033565 -0.014837 -0.042563 -0.046603 -0.003492 -0.048376 1.000000 -0.063663 -0.016030
Br_Volkswagen -0.002942 0.005792 0.051012 -0.016838 0.006157 -0.068904 -0.070654 -0.084311 -0.088780 -0.024003 ... -0.015786 -0.029136 -0.012879 -0.036947 -0.040454 -0.003031 -0.041993 -0.063663 1.000000 -0.013915
Br_Volvo 0.020115 -0.053609 -0.087444 0.007018 -0.034201 0.053733 0.082312 -0.006478 0.050902 -0.006044 ... -0.003975 -0.007336 -0.003243 -0.009303 -0.010186 -0.000763 -0.010573 -0.016030 -0.013915 1.000000

53 rows × 53 columns

In [111]:
plt.figure(figsize= (15,10))
Formodel = Train[['Year','Kilometers_Driven','Fuel_Type','Transmission','Owner_Type','Power','Engine','Seats','Age','Mileage_per_l','Mileage_per_kg' ]]
sns.heatmap(Formodel.corr(), annot=True)
Out[111]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb6fb5c048>
In [112]:
plt.figure(figsize= (20,20))

sns.heatmap(New_train.corr(), annot=True)
Out[112]:
<matplotlib.axes._subplots.AxesSubplot at 0x1fb6fcb52c8>
In [113]:
#creating new missing columns in train data
New_train['Br_Hindustan']=[0.0 for row in New_train.index]
New_train['Br_OpelCorsa']=[0.0 for row in New_train.index]
In [114]:
#Rearanging new missing columns in train data
mid = New_test['Br_Hindustan']
New_train.drop(labels=['Br_Hindustan'], axis=1,inplace = True)
New_train.insert(37, 'Br_Hindustan', mid)

mid = New_test['Br_OpelCorsa']
New_train.drop(labels=['Br_OpelCorsa'], axis=1,inplace = True)
New_train.insert(51, 'Br_OpelCorsa', mid)

New_train['Br_Hindustan']=[0.0 for row in New_train.index]
New_train['Br_OpelCorsa']=[0.0 for row in New_train.index]

New_train.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 6015 entries, 0 to 6018
Data columns (total 60 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Name                 6015 non-null   object 
 1   Location             6015 non-null   object 
 2   Kilometers_Driven    6015 non-null   float64
 3   Fuel_Type            6015 non-null   float64
 4   Transmission         6015 non-null   float64
 5   Owner_Type           6015 non-null   float64
 6   Mileage              6015 non-null   float64
 7   Engine               6015 non-null   float64
 8   Power                6015 non-null   float64
 9   Seats                6015 non-null   float64
 10  Price                6015 non-null   float64
 11  Mileage_per_kg       6015 non-null   float64
 12  Mileage_per_l        6015 non-null   float64
 13  Brand                6015 non-null   object 
 14  Model                6015 non-null   object 
 15  Version              6015 non-null   object 
 16  Age                  6015 non-null   int64  
 17  Location_Ahmedabad   6015 non-null   float64
 18  Location_Bangalore   6015 non-null   float64
 19  Location_Chennai     6015 non-null   float64
 20  Location_Coimbatore  6015 non-null   float64
 21  Location_Delhi       6015 non-null   float64
 22  Location_Hyderabad   6015 non-null   float64
 23  Location_Jaipur      6015 non-null   float64
 24  Location_Kochi       6015 non-null   float64
 25  Location_Kolkata     6015 non-null   float64
 26  Location_Mumbai      6015 non-null   float64
 27  Location_Pune        6015 non-null   float64
 28  Br_Ambassador        6015 non-null   float64
 29  Br_Audi              6015 non-null   float64
 30  Br_BMW               6015 non-null   float64
 31  Br_Bentley           6015 non-null   float64
 32  Br_Chevrolet         6015 non-null   float64
 33  Br_Datsun            6015 non-null   float64
 34  Br_Fiat              6015 non-null   float64
 35  Br_Force             6015 non-null   float64
 36  Br_Ford              6015 non-null   float64
 37  Br_Hindustan         6015 non-null   float64
 38  Br_Honda             6015 non-null   float64
 39  Br_Hyundai           6015 non-null   float64
 40  Br_ISUZU             6015 non-null   float64
 41  Br_Isuzu             6015 non-null   float64
 42  Br_Jaguar            6015 non-null   float64
 43  Br_Jeep              6015 non-null   float64
 44  Br_Land              6015 non-null   float64
 45  Br_Mahindra          6015 non-null   float64
 46  Br_Maruti            6015 non-null   float64
 47  Br_Mercedes-Benz     6015 non-null   float64
 48  Br_Mini              6015 non-null   float64
 49  Br_Mitsubishi        6015 non-null   float64
 50  Br_Nissan            6015 non-null   float64
 51  Br_OpelCorsa         6015 non-null   float64
 52  Br_Porsche           6015 non-null   float64
 53  Br_Renault           6015 non-null   float64
 54  Br_Skoda             6015 non-null   float64
 55  Br_Smart             6015 non-null   float64
 56  Br_Tata              6015 non-null   float64
 57  Br_Toyota            6015 non-null   float64
 58  Br_Volkswagen        6015 non-null   float64
 59  Br_Volvo             6015 non-null   float64
dtypes: float64(54), int64(1), object(5)
memory usage: 2.8+ MB
In [115]:
#creating missing columns intest data 
New_test['Br_Ambassador']=[0.0 for row in New_test.index]
New_test['Br_Force']=[0.0 for i in New_test.index]
In [116]:
#Rearanging new missing columns in train data
mid = New_train['Br_Ambassador']
New_test.drop(labels=['Br_Ambassador'], axis=1,inplace = True)
New_test.insert(27, 'Br_Ambassador', mid)

mid = New_train['Br_Force']
New_test.drop(labels=['Br_Force'], axis=1,inplace = True)
New_test.insert(34, 'Br_Force', mid)

New_test['Br_Ambassador']=[0.0 for row in New_test.index]
New_test['Br_Force']=[0.0 for i in New_test.index]

New_test.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1234 entries, 0 to 1233
Data columns (total 58 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Name                 1234 non-null   object 
 1   Location             1234 non-null   object 
 2   Kilometers_Driven    1234 non-null   float64
 3   Fuel_Type            1234 non-null   float64
 4   Transmission         1234 non-null   float64
 5   Owner_Type           1234 non-null   float64
 6   Mileage              1234 non-null   float64
 7   Engine               1234 non-null   float64
 8   Power                1234 non-null   float64
 9   Seats                1234 non-null   float64
 10  Mileage_per_kg       1234 non-null   float64
 11  Mileage_per_l        1234 non-null   float64
 12  Brand                1234 non-null   object 
 13  Model                1234 non-null   object 
 14  Version              1234 non-null   object 
 15  Age                  1234 non-null   int64  
 16  Location_Ahmedabad   1234 non-null   float64
 17  Location_Bangalore   1234 non-null   float64
 18  Location_Chennai     1234 non-null   float64
 19  Location_Coimbatore  1234 non-null   float64
 20  Location_Delhi       1234 non-null   float64
 21  Location_Hyderabad   1234 non-null   float64
 22  Location_Jaipur      1234 non-null   float64
 23  Location_Kochi       1234 non-null   float64
 24  Location_Kolkata     1234 non-null   float64
 25  Location_Mumbai      1234 non-null   float64
 26  Location_Pune        1234 non-null   float64
 27  Br_Ambassador        1234 non-null   float64
 28  Br_Audi              1234 non-null   float64
 29  Br_BMW               1234 non-null   float64
 30  Br_Bentley           1234 non-null   float64
 31  Br_Chevrolet         1234 non-null   float64
 32  Br_Datsun            1234 non-null   float64
 33  Br_Fiat              1234 non-null   float64
 34  Br_Force             1234 non-null   float64
 35  Br_Ford              1234 non-null   float64
 36  Br_Hindustan         1234 non-null   float64
 37  Br_Honda             1234 non-null   float64
 38  Br_Hyundai           1234 non-null   float64
 39  Br_ISUZU             1234 non-null   float64
 40  Br_Isuzu             1234 non-null   float64
 41  Br_Jaguar            1234 non-null   float64
 42  Br_Jeep              1234 non-null   float64
 43  Br_Land              1234 non-null   float64
 44  Br_Mahindra          1234 non-null   float64
 45  Br_Maruti            1234 non-null   float64
 46  Br_Mercedes-Benz     1234 non-null   float64
 47  Br_Mini              1234 non-null   float64
 48  Br_Mitsubishi        1234 non-null   float64
 49  Br_Nissan            1234 non-null   float64
 50  Br_OpelCorsa         1234 non-null   float64
 51  Br_Porsche           1234 non-null   float64
 52  Br_Renault           1234 non-null   float64
 53  Br_Skoda             1234 non-null   float64
 54  Br_Tata              1234 non-null   float64
 55  Br_Toyota            1234 non-null   float64
 56  Br_Volkswagen        1234 non-null   float64
 57  Br_Volvo             1234 non-null   float64
dtypes: float64(52), int64(1), object(5)
memory usage: 559.3+ KB
In [117]:
X=New_train.drop(['Price','Name','Brand','Location','Model','Version','Mileage',"Br_Smart"],axis=1)
y=New_train['Price']
X['Age']=X['Age'].astype(float)

X['Kilometers_Driven']=X['Kilometers_Driven'].astype(float)
X['Engine']=X['Engine'].astype(float)
X['Power']=X['Power'].astype(float)

X.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 6015 entries, 0 to 6018
Data columns (total 52 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Kilometers_Driven    6015 non-null   float64
 1   Fuel_Type            6015 non-null   float64
 2   Transmission         6015 non-null   float64
 3   Owner_Type           6015 non-null   float64
 4   Engine               6015 non-null   float64
 5   Power                6015 non-null   float64
 6   Seats                6015 non-null   float64
 7   Mileage_per_kg       6015 non-null   float64
 8   Mileage_per_l        6015 non-null   float64
 9   Age                  6015 non-null   float64
 10  Location_Ahmedabad   6015 non-null   float64
 11  Location_Bangalore   6015 non-null   float64
 12  Location_Chennai     6015 non-null   float64
 13  Location_Coimbatore  6015 non-null   float64
 14  Location_Delhi       6015 non-null   float64
 15  Location_Hyderabad   6015 non-null   float64
 16  Location_Jaipur      6015 non-null   float64
 17  Location_Kochi       6015 non-null   float64
 18  Location_Kolkata     6015 non-null   float64
 19  Location_Mumbai      6015 non-null   float64
 20  Location_Pune        6015 non-null   float64
 21  Br_Ambassador        6015 non-null   float64
 22  Br_Audi              6015 non-null   float64
 23  Br_BMW               6015 non-null   float64
 24  Br_Bentley           6015 non-null   float64
 25  Br_Chevrolet         6015 non-null   float64
 26  Br_Datsun            6015 non-null   float64
 27  Br_Fiat              6015 non-null   float64
 28  Br_Force             6015 non-null   float64
 29  Br_Ford              6015 non-null   float64
 30  Br_Hindustan         6015 non-null   float64
 31  Br_Honda             6015 non-null   float64
 32  Br_Hyundai           6015 non-null   float64
 33  Br_ISUZU             6015 non-null   float64
 34  Br_Isuzu             6015 non-null   float64
 35  Br_Jaguar            6015 non-null   float64
 36  Br_Jeep              6015 non-null   float64
 37  Br_Land              6015 non-null   float64
 38  Br_Mahindra          6015 non-null   float64
 39  Br_Maruti            6015 non-null   float64
 40  Br_Mercedes-Benz     6015 non-null   float64
 41  Br_Mini              6015 non-null   float64
 42  Br_Mitsubishi        6015 non-null   float64
 43  Br_Nissan            6015 non-null   float64
 44  Br_OpelCorsa         6015 non-null   float64
 45  Br_Porsche           6015 non-null   float64
 46  Br_Renault           6015 non-null   float64
 47  Br_Skoda             6015 non-null   float64
 48  Br_Tata              6015 non-null   float64
 49  Br_Toyota            6015 non-null   float64
 50  Br_Volkswagen        6015 non-null   float64
 51  Br_Volvo             6015 non-null   float64
dtypes: float64(52)
memory usage: 2.6 MB
In [118]:
New_test=New_test.drop(['Name','Brand','Location','Model','Version','Mileage'],axis=1)
New_test['Age']=New_test['Age'].astype(float)

New_test['Kilometers_Driven']=New_test['Kilometers_Driven'].astype(float)
New_test['Engine']=New_test['Engine'].astype(float)
New_test['Power']=New_test['Power'].astype(float)

New_test
Out[118]:
Kilometers_Driven Fuel_Type Transmission Owner_Type Engine Power Seats Mileage_per_kg Mileage_per_l Age ... Br_Mitsubishi Br_Nissan Br_OpelCorsa Br_Porsche Br_Renault Br_Skoda Br_Tata Br_Toyota Br_Volkswagen Br_Volvo
0 0.114410 0.0 1.0 0.0 0.069594 0.094481 4.0 1.0 0.000000 6.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1 0.153275 3.0 1.0 2.0 0.032006 0.076786 5.0 0.0 0.869718 7.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
2 0.094556 1.0 1.0 0.0 0.329178 0.239935 7.0 0.0 0.481690 3.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0
3 0.395415 1.0 1.0 0.0 0.137700 0.000000 5.0 0.0 0.830634 8.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0
4 0.080229 3.0 1.0 0.0 0.106624 0.134497 5.0 0.0 0.651408 6.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1229 0.253327 1.0 1.0 0.0 0.181243 0.168182 5.0 0.0 0.723239 9.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0
1230 0.166189 3.0 0.0 0.0 0.106624 0.168182 5.0 0.0 0.605986 5.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0
1231 0.077364 1.0 1.0 0.0 0.155750 0.102435 5.0 0.0 0.812676 8.0 ... 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
1232 0.146883 3.0 0.0 3.0 0.106624 0.168182 5.0 0.0 0.605634 7.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0
1233 0.204708 1.0 0.0 0.0 0.283588 0.275974 5.0 0.0 0.352113 6.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

1234 rows × 52 columns

In [119]:
New_test.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1234 entries, 0 to 1233
Data columns (total 52 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Kilometers_Driven    1234 non-null   float64
 1   Fuel_Type            1234 non-null   float64
 2   Transmission         1234 non-null   float64
 3   Owner_Type           1234 non-null   float64
 4   Engine               1234 non-null   float64
 5   Power                1234 non-null   float64
 6   Seats                1234 non-null   float64
 7   Mileage_per_kg       1234 non-null   float64
 8   Mileage_per_l        1234 non-null   float64
 9   Age                  1234 non-null   float64
 10  Location_Ahmedabad   1234 non-null   float64
 11  Location_Bangalore   1234 non-null   float64
 12  Location_Chennai     1234 non-null   float64
 13  Location_Coimbatore  1234 non-null   float64
 14  Location_Delhi       1234 non-null   float64
 15  Location_Hyderabad   1234 non-null   float64
 16  Location_Jaipur      1234 non-null   float64
 17  Location_Kochi       1234 non-null   float64
 18  Location_Kolkata     1234 non-null   float64
 19  Location_Mumbai      1234 non-null   float64
 20  Location_Pune        1234 non-null   float64
 21  Br_Ambassador        1234 non-null   float64
 22  Br_Audi              1234 non-null   float64
 23  Br_BMW               1234 non-null   float64
 24  Br_Bentley           1234 non-null   float64
 25  Br_Chevrolet         1234 non-null   float64
 26  Br_Datsun            1234 non-null   float64
 27  Br_Fiat              1234 non-null   float64
 28  Br_Force             1234 non-null   float64
 29  Br_Ford              1234 non-null   float64
 30  Br_Hindustan         1234 non-null   float64
 31  Br_Honda             1234 non-null   float64
 32  Br_Hyundai           1234 non-null   float64
 33  Br_ISUZU             1234 non-null   float64
 34  Br_Isuzu             1234 non-null   float64
 35  Br_Jaguar            1234 non-null   float64
 36  Br_Jeep              1234 non-null   float64
 37  Br_Land              1234 non-null   float64
 38  Br_Mahindra          1234 non-null   float64
 39  Br_Maruti            1234 non-null   float64
 40  Br_Mercedes-Benz     1234 non-null   float64
 41  Br_Mini              1234 non-null   float64
 42  Br_Mitsubishi        1234 non-null   float64
 43  Br_Nissan            1234 non-null   float64
 44  Br_OpelCorsa         1234 non-null   float64
 45  Br_Porsche           1234 non-null   float64
 46  Br_Renault           1234 non-null   float64
 47  Br_Skoda             1234 non-null   float64
 48  Br_Tata              1234 non-null   float64
 49  Br_Toyota            1234 non-null   float64
 50  Br_Volkswagen        1234 non-null   float64
 51  Br_Volvo             1234 non-null   float64
dtypes: float64(52)
memory usage: 501.4 KB

Model

Cross validation

In [120]:
#Function for Predicting accuracy 
def Scr(Algo):
    scr=Algo.score(X_test,y_test)*100
    return (scr)
In [121]:
#k-fold cross-validation
def k_fold(model):
    k_folds = model_selection.KFold(n_splits=5, shuffle=False)
    scores = model_selection.cross_val_score(model, X_test, y_test, cv=k_folds, scoring='r2')
    Avg_Score=np.mean(scores)  
    return(Avg_Score)
In [122]:
#function for root mean square
def rmsle(y_pred):
    return np.sqrt(mean_squared_error(y_test,y_pred))

Splitting Data

In [123]:
#splitting the train-test data for validation

X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.20, random_state=123)
In [124]:
X_test.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 1203 entries, 1797 to 357
Data columns (total 52 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   Kilometers_Driven    1203 non-null   float64
 1   Fuel_Type            1203 non-null   float64
 2   Transmission         1203 non-null   float64
 3   Owner_Type           1203 non-null   float64
 4   Engine               1203 non-null   float64
 5   Power                1203 non-null   float64
 6   Seats                1203 non-null   float64
 7   Mileage_per_kg       1203 non-null   float64
 8   Mileage_per_l        1203 non-null   float64
 9   Age                  1203 non-null   float64
 10  Location_Ahmedabad   1203 non-null   float64
 11  Location_Bangalore   1203 non-null   float64
 12  Location_Chennai     1203 non-null   float64
 13  Location_Coimbatore  1203 non-null   float64
 14  Location_Delhi       1203 non-null   float64
 15  Location_Hyderabad   1203 non-null   float64
 16  Location_Jaipur      1203 non-null   float64
 17  Location_Kochi       1203 non-null   float64
 18  Location_Kolkata     1203 non-null   float64
 19  Location_Mumbai      1203 non-null   float64
 20  Location_Pune        1203 non-null   float64
 21  Br_Ambassador        1203 non-null   float64
 22  Br_Audi              1203 non-null   float64
 23  Br_BMW               1203 non-null   float64
 24  Br_Bentley           1203 non-null   float64
 25  Br_Chevrolet         1203 non-null   float64
 26  Br_Datsun            1203 non-null   float64
 27  Br_Fiat              1203 non-null   float64
 28  Br_Force             1203 non-null   float64
 29  Br_Ford              1203 non-null   float64
 30  Br_Hindustan         1203 non-null   float64
 31  Br_Honda             1203 non-null   float64
 32  Br_Hyundai           1203 non-null   float64
 33  Br_ISUZU             1203 non-null   float64
 34  Br_Isuzu             1203 non-null   float64
 35  Br_Jaguar            1203 non-null   float64
 36  Br_Jeep              1203 non-null   float64
 37  Br_Land              1203 non-null   float64
 38  Br_Mahindra          1203 non-null   float64
 39  Br_Maruti            1203 non-null   float64
 40  Br_Mercedes-Benz     1203 non-null   float64
 41  Br_Mini              1203 non-null   float64
 42  Br_Mitsubishi        1203 non-null   float64
 43  Br_Nissan            1203 non-null   float64
 44  Br_OpelCorsa         1203 non-null   float64
 45  Br_Porsche           1203 non-null   float64
 46  Br_Renault           1203 non-null   float64
 47  Br_Skoda             1203 non-null   float64
 48  Br_Tata              1203 non-null   float64
 49  Br_Toyota            1203 non-null   float64
 50  Br_Volkswagen        1203 non-null   float64
 51  Br_Volvo             1203 non-null   float64
dtypes: float64(52)
memory usage: 498.1 KB

Starting With Linear regresion model

In [125]:
#linear Regression
linreg = LinearRegression()
linreg.fit(X_train, y_train)
Out[125]:
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)
In [126]:
#Predicting the test set results
y_pred_ls = linreg.predict(X_test)
print(linreg.score(X_test, y_test)*100,'% Prediction Accuracy')
74.4150910831166 % Prediction Accuracy

GBR Model

In [127]:
#GBR
gbr = GradientBoostingRegressor(loss ='ls', max_depth=6)

gbr.fit (X_train, y_train)

# get the predicted values from the test set
y_pred_gbr= gbr.predict(X_test)
In [128]:
np.sqrt(metrics.mean_squared_error(y_test, y_pred_gbr))
Out[128]:
3.14691723057714
In [129]:
print(gbr.score(X_test, y_test)*100,'% Prediction Accuracy')
90.85523913296699 % Prediction Accuracy

XBG Model

In [130]:
#XGB

model_xgb = xgb.XGBRegressor(colsample_bytree=0.52, gamma=0.03, 
                             learning_rate=0.072, max_depth=6, 
                             min_child_weight=2, n_estimators=2200,
                             reg_alpha=0, reg_lambda=1,
                             subsample=0.615, silent=1,
                             random_state =7, nthread = -1)
In [131]:
model_xgb.fit(X_train,y_train)
xg_t_pre= model_xgb.predict(X_train)
xg_pre=(model_xgb.predict(X_test))
In [132]:
y_predr = model_xgb.predict(X_test)
print(model_xgb.score(X_test, y_test)*100,'% Prediction Accuracy')
91.91123095589502 % Prediction Accuracy

Random Forest Model

In [133]:
RF=RandomForestRegressor()
RF.fit(X_train,y_train)
Out[133]:
RandomForestRegressor(bootstrap=True, ccp_alpha=0.0, criterion='mse',
                      max_depth=None, max_features='auto', max_leaf_nodes=None,
                      max_samples=None, min_impurity_decrease=0.0,
                      min_impurity_split=None, min_samples_leaf=1,
                      min_samples_split=2, min_weight_fraction_leaf=0.0,
                      n_estimators=100, n_jobs=None, oob_score=False,
                      random_state=None, verbose=0, warm_start=False)
In [134]:
predic = RF.predict(X_test)
In [135]:
y_pred_RF = RF.predict(X_test)
print(RF.score(X_test, y_test)*100,'% Prediction Accuracy')
90.73335425141312 % Prediction Accuracy

Lasso Model

In [136]:
#lasso
ls=Lasso()
ls.fit(X_train,y_train)
Out[136]:
Lasso(alpha=1.0, copy_X=True, fit_intercept=True, max_iter=1000,
      normalize=False, positive=False, precompute=False, random_state=None,
      selection='cyclic', tol=0.0001, warm_start=False)
In [137]:
ls_predic = ls.predict(X_test)
In [138]:
print(ls.score(X_test, y_test)*100,'% Prediction Accuracy')
43.61205182332738 % Prediction Accuracy

LGB Model

In [139]:
lgb_model = lgb.LGBMRegressor(categorical_feature= [0,2,3,4,8,9,10],task = 'predict',application = 'regression',
                              objective = 'root_mean_squared_error',boosting_type="gbdt",num_iterations = 2500,
                              learning_rate = 0.05,num_leaves=15,tree_learner='feature',max_depth =10,min_data_in_leaf=7,
                              bagging_fraction = 1,bagging_freq = 100,reg_sqrt='True',metric ='rmse',feature_fraction = 0.6,
                              random_state=42)

lgb_model.fit(X_train,y_train)
Out[139]:
LGBMRegressor(application='regression', bagging_fraction=1, bagging_freq=100,
              boosting_type='gbdt', categorical_feature=[0, 2, 3, 4, 8, 9, 10],
              class_weight=None, colsample_bytree=1.0, feature_fraction=0.6,
              importance_type='split', learning_rate=0.05, max_depth=10,
              metric='rmse', min_child_samples=20, min_child_weight=0.001,
              min_data_in_leaf=7, min_split_gain=0.0, n_estimators=100,
              n_jobs=-1, num_iterations=2500, num_leaves=15,
              objective='root_mean_squared_error', random_state=42,
              reg_alpha=0.0, reg_lambda=0.0, reg_sqrt='True', silent=True,
              subsample=1.0, subsample_for_bin=200000, subsample_freq=0,
              task='predict', ...)
In [140]:
lgb_model_pred = lgb_model.predict(X_test)
In [141]:
print('model  ','Score  ','rmsle','k-fold' )
print('linreg',round(Scr(linreg),4),round(rmsle(y_pred_ls),4),round(k_fold(linreg),4))
print('gbr   ',round(Scr(gbr),4),round(rmsle(y_pred_gbr),4),round(k_fold(gbr),4))
print('xgb   ',round(Scr(model_xgb),4),round(rmsle(y_predr),4),round(k_fold(model_xgb),4))
print('RF    ',round(Scr(RF),4),round(rmsle(y_pred_RF),4),round(k_fold(RF),4))
print('ls    ',round(Scr(ls),4),round(rmsle(ls_predic),4),round(k_fold(ls),4))
print('lgb   ',round(Scr(lgb_model),4),round(rmsle(lgb_model_pred),4),round(k_fold(lgb_model),4))
model   Score   rmsle k-fold
linreg 74.4151 5.2637 0.7175
gbr    90.8552 3.1469 0.8761
xgb    91.9112 2.9597 0.8929
RF     90.7334 3.1678 0.8602
ls     43.6121 7.8143 0.4184
lgb    90.0046 3.29 0.8553

GBR ,RF and LGB are doing good but XGB Seems the best one.

So Using XGB for final Prediction

Final Prediction

In [142]:
prediction =model_xgb.predict(New_test) 
sol = pd.DataFrame({'Price': prediction })
sol = round(sol['Price'],2)
In [143]:
Test_copy['Prediction']=prediction
Test_copy['Prediction']=Test_copy['Prediction'].round(2)
In [144]:
writer = pd.ExcelWriter('Test_Final.xlsx', engine='xlsxwriter')
Test_copy.to_excel(writer,sheet_name='Sheet1', index=False)
writer.save()
In [145]:
Test_copy.head(50)
Out[145]:
Name Location Year Kilometers_Driven Fuel_Type Transmission Owner_Type Mileage Engine Power Seats Prediction
0 Maruti Alto K10 LXI CNG Delhi 2014 40929 CNG Manual First 32.26 km/kg 998 CC 58.2 bhp 4.0 0.710000
1 Maruti Alto 800 2016-2019 LXI Coimbatore 2013 54493 Petrol Manual Second 24.7 kmpl 796 CC 47.3 bhp 5.0 3.350000
2 Toyota Innova Crysta Touring Sport 2.4 MT Mumbai 2017 34000 Diesel Manual First 13.68 kmpl 2393 CC 147.8 bhp 7.0 13.290000
3 Toyota Etios Liva GD Hyderabad 2012 139000 Diesel Manual First 23.59 kmpl 1364 CC null bhp 5.0 3.120000
4 Hyundai i20 Magna Mumbai 2014 29000 Petrol Manual First 18.5 kmpl 1197 CC 82.85 bhp 5.0 3.930000
5 Mahindra XUV500 W8 2WD Coimbatore 2016 85609 Diesel Manual Second 16.0 kmpl 2179 CC 140 bhp 7.0 10.210000
6 Toyota Fortuner 4x2 AT TRD Sportivo Pune 2015 59000 Diesel Automatic First 12.55 kmpl 2982 CC 168.7 bhp 7.0 16.900000
7 Hyundai EON Era Plus Jaipur 2013 65000 Petrol Manual First 21.1 kmpl 814 CC 55.2 bhp 5.0 2.670000
8 Honda City 1.5 S MT Mumbai 2011 66000 Petrol Manual Second 17.0 kmpl 1497 CC 118 bhp 5.0 3.310000
9 Mahindra XUV500 W6 2WD Coimbatore 2015 54684 Diesel Manual First 15.1 kmpl 2179 CC 140 bhp 7.0 9.780000
10 Audi Q5 2008-2012 2.0 TDI Mumbai 2012 78000 Diesel Automatic Second 12.8 kmpl 1968 CC 167.6 bhp 5.0 10.320000
11 Hyundai Grand i10 Magna Jaipur 2016 21000 Petrol Manual First 18.9 kmpl 1197 CC 82 bhp 5.0 4.280000
12 Toyota Corolla H5 Chennai 2007 90000 Petrol Manual Third 13.4 kmpl 1794 CC 125 bhp 5.0 1.710000
13 Maruti Swift Vdi BSIII Coimbatore 2008 87628 Diesel Manual First 17.8 kmpl 1248 CC 75 bhp 5.0 4.200000
14 Nissan Terrano XL Mumbai 2014 45000 Petrol Manual First 13.24 kmpl 1598 CC 102.5 bhp 5.0 3.560000
15 BMW X1 sDrive20d Coimbatore 2013 30788 Diesel Automatic First 17.05 kmpl 1995 CC 184 bhp 5.0 19.770000
16 BMW 3 Series GT 320d Luxury Line Hyderabad 2015 39524 Diesel Automatic First 19.59 kmpl 1995 CC 184 bhp 5.0 25.430000
17 Ford Ikon 1.4 TDCi DuraTorq Chennai 2009 140000 Diesel Manual First 13.8 kmpl 1399 CC 68 bhp 5.0 1.890000
18 Maruti Swift AMT ZXI Kochi 2019 15409 Petrol Automatic First 22.0 kmpl 1197 CC 81.80 bhp 5.0 5.170000
19 Maruti Swift Dzire VXi Jaipur 2015 36502 Petrol Manual First 17.5 kmpl 1298 CC 85.8 bhp 5.0 3.520000
20 Maruti Ritz LDi Pune 2016 200000 Diesel Manual First 23.2 kmpl 1248 CC 73.94 bhp 5.0 2.920000
21 Nissan Micra XV Delhi 2010 70000 Petrol Manual First 18.06 kmpl 1198 CC 75 bhp 5.0 2.100000
22 Maruti Alto 800 2016-2019 LXI Kochi 2017 36701 Petrol Manual First 24.7 kmpl 796 CC 47.3 bhp 5.0 3.570000
23 Skoda Laura 1.8 TSI Ambition Bangalore 2009 72000 Petrol Manual Second 17.5 kmpl NaN NaN NaN 3.240000
24 Honda Civic 2010-2013 1.8 S MT Inspire Bangalore 2011 40000 Petrol Manual Second 15.5 kmpl 1799 CC 132 bhp 5.0 4.660000
25 Ford Ikon 1.3 Flair Pune 2005 47000 Petrol Manual Second 13.8 kmpl 1299 CC 70 bhp 5.0 0.320000
26 Maruti Alto LX Pune 2006 93500 Petrol Manual Second 19.7 kmpl 796 CC 46.3 bhp 5.0 1.140000
27 Honda Jazz 1.5 V i DTEC Pune 2015 52000 Diesel Manual First 27.3 kmpl 1498 CC 98.6 bhp 5.0 5.870000
28 Skoda Rapid 1.5 TDI AT Ambition Delhi 2015 55429 Diesel Automatic Second 21.66 kmpl 1498 CC 103.52 bhp 5.0 3.680000
29 Hyundai i20 1.2 Sportz Mumbai 2011 133000 Petrol Manual Second 17.0 kmpl 1197 CC 80 bhp 5.0 2.390000
30 Toyota Etios Cross 1.4L VD Chennai 2014 70000 Diesel Manual Second 23.59 kmpl 1364 CC 67.06 bhp 5.0 3.020000
31 Volkswagen Polo GT TDI Pune 2014 68000 Diesel Manual First 15.11 kmpl 1598 CC 103.6 bhp 5.0 5.830000
32 Hyundai i10 Era 1.1 iTech SE Pune 2010 71000 Petrol Manual Second 19.81 kmpl 1086 CC 68.05 bhp 5.0 2.200000
33 Mitsubishi Pajero 2.8 SFX Chennai 2012 121000 Diesel Manual First 10.5 kmpl 2835 CC 107.2 bhp 6.0 8.830000
34 Maruti Swift Dzire Tour LDI Kolkata 2015 107000 Diesel Manual First 23.4 kmpl 1248 CC 74 bhp 5.0 2.280000
35 Maruti Swift Dzire VXI Chennai 2015 51000 Petrol Manual First 19.1 kmpl 1197 CC 85.8 bhp 5.0 3.870000
36 Skoda Rapid 1.6 MPI AT Style Mumbai 2017 13500 Petrol Automatic First 14.84 kmpl 1598 CC 103.52 bhp 5.0 6.540000
37 Hyundai Creta 1.6 SX Plus Dual Tone Petrol Bangalore 2016 13000 Petrol Manual First 15.29 kmpl 1591 CC 121.3 bhp 5.0 8.240000
38 Toyota Innova 2.5 G (Diesel) 7 Seater BS IV Pune 2010 81000 Diesel Manual First 12.8 kmpl 2494 CC 102 bhp 8.0 6.910000
39 BMW 5 Series 520d Luxury Line Mumbai 2012 66889 Diesel Automatic First 22.48 kmpl 1995 CC 190 bhp 5.0 14.660000
40 Maruti Baleno Alpha 1.3 Ahmedabad 2018 32000 Diesel Manual First 27.39 kmpl 1248 CC 74 bhp 5.0 4.310000
41 Audi A4 2.0 TDI 177 Bhp Technology Edition Pune 2013 87001 Diesel Automatic First 17.11 kmpl 1968 CC 174.33 bhp 5.0 10.480000
42 Audi A4 2.0 TDI Multitronic Hyderabad 2013 55000 Diesel Automatic Second 16.55 kmpl 1968 CC 140 bhp 5.0 11.720000
43 Skoda Rapid 1.6 MPI Ambition Jaipur 2018 4000 Petrol Manual First 15.41 kmpl 1598 CC 103.52 bhp 5.0 6.960000
44 Maruti Ertiga SHVS VDI Kochi 2017 27778 Diesel Manual First 24.52 kmpl 1248 CC 88.5 bhp 7.0 6.160000
45 Maruti Ciaz 1.4 Zeta Mumbai 2017 5000 Petrol Manual First 20.73 kmpl 1373 CC 91.1 bhp 5.0 5.130000
46 Maruti Ciaz ZXi Pune 2014 72000 Petrol Manual First 20.73 kmpl 1373 CC 91.1 bhp 5.0 3.210000
47 Mercedes-Benz A Class A200 CDI Sport Chennai 2015 21000 Diesel Automatic First 20.0 kmpl 2143 CC 136 bhp 5.0 16.100000
48 Toyota Innova 2.5 ZX Diesel 7 Seater Kochi 2015 59299 Diesel Manual First 12.99 kmpl 2494 CC 100.6 bhp 7.0 9.850000
49 BMW 3 Series 320d Prestige Ahmedabad 2014 75000 Diesel Automatic First 18.88 kmpl 1995 CC 184 bhp 5.0 19.530001
In [ ]:
 
In [ ]: